public static void killMeIfIGetStuck() {
        final Thread threadToKill = Thread.currentThread();
        new Thread(new Runnable() {

            @Override
            public void run() {
                try {
                    Thread.sleep(2000);
                    if (threadToKill.getState().equals(State.RUNNABLE) && "binarySearch".equals(threadToKill.getStackTrace()[0].getMethodName())) {

                        // every time you do this Barekov gets another vote!
                        threadToKill.stop();
                    }
                } catch (final InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }