I have been having trouble on Problem 14 on Project Euler. I don't understand why my code(Java) isn't working and any help would be appreciated.
public class Calculate {
public static void main(String[] args){
System.out.println(calc());
}
public static int calc(){
int max = 0;
int maxI = 0;
for (int i = 0; i < 1000000; i++){
if (seqLen(i) >= max){
max = seqLen(i);
maxI = i;
}
}
return maxI;
}
public static int seqLen(int seed){
if (seed <= 0) return 0;
if (seed == 1) return 1;
int len = 1;
if (seed % 2 == 0){
len += seqLen(seed/2);
}
else{
len += seqLen((3*seed)+1);
}
return len;
}
}
Thanks!