I have the current code used to complete one of the Project Euler tasks:
public static void mod(int value){
int[] modValues = {11,12,13,14,15,16,17,18,19,20};
int y = 0;
for(int x = 0; x < 10; x++){
int originalValue = value;
int modSum = value % modValues[x];
if(modSum == 0){
y += 1;
if(y == 10){
System.out.println(originalValue);
break;
}
}
}
}
public static void main(String[] args) {
final long startTime = System.nanoTime(); //<<<ignore//
int x;
for(x = 0; x < Integer.MAX_VALUE; x++){
mod(x);
}
}
Now my question is how can I get the whole program to break once the first value (232792560) is found from the method. My current break at the if(y == 10){ break;}
does not do this.