public class ModulusFinder { public static void main(String[] args) { int i = 0; while (!test(i)) { System.out.println(i++); } System.out.println("lowest answer: " + i); } static boolean test(int x) { if (x % 3 != 1) { return false; } if (x % 5 != 2) { return false; } if (x % 11 != 8) { return false; } return true; } }