I'm putting together a code for a hailstone sequence I found in an online tutorial, but in doing so I ran into an unreachable statement error. I don't know if my code is correct and I don't want advice in correcting it if I'm wrong(regarding the hailstone sequence, I want to do that myself..:) ). I just want help in resolving the "unreachable statement" error at line 19.
class HailstoneSequence {
public static void main(String[] args) {
int[][] a = new int[10][];
a[0][0] = 125;
int number = 125;
for (int i = 0;; i++) {
for (int j = 1; j < 10; j++) {
if (number % 2 == 0) {
a[i][j] = number / 2;
number = number / 2;
} else {
a[i][j] = (number * 3) + 1;
number = (number * 3) + 1;
}
}
}
for (int i = 0;; i++) {
for (int j = 0; j < 10; j++) {
System.out.println(a[i][j]);
}
}
}
}