import java.io.PrintStream; // Makes it find Kirk every time. // Works for me every time... but might be system dependent. public class FindKirk { public static void main(String[] args) throws InterruptedException { // warmup, avoiding that initialization taking an identity hash code gets in our way JavaChampionTest.main(); // hash code 2134400190 is an early twin. 1802421938 comes 2 before the first occurrence, // so run up to that one; then Jack will take the one in between, and the first Kirk gets the // first of the twin while (new Object().hashCode() != 1802421938); // override System.out to do something between the creating of the first and the second Kirk // (without changing the original code) System.setOut(new PrintStream(System.out) { boolean done; @Override public void println(String x) { // 760371604 comes just before the second occurrence of the twin while (!done && new Object().hashCode() != 760371604); done = true; super.println(x); } }); JavaChampionTest.main(); } }