Check if numbers are consecutive java