Simple java authenticator. import java.io.*; import java.util.*; public class test implements Runnable{ int code; Random random; BufferedReader reader; Thread thread; String answer; int intanswer; public void controll(){ if(intanswer != code){ System.out.println("Authentication failed."); System.exit(0);}} void authenticate()throws IOException{ thread=new Thread(); random=new Random(); reader=new BufferedReader(new InputStreamReader(System.in)); code=random.nextInt(999999999); System.out.println("Please, rewrite generated code below: " + code); answer=reader.readLine(); intanswer=Integer.parseInt(answer); try{ System.out.println("\n" + "Checking..."); thread.sleep(2500); controll(); System.out.println("Confirming..."); thread.sleep(3000); controll(); System.out.println("Done!"); } catch(InterruptedException e){System.out.println(e);} } public void run(){} public static void main(String args[])throws IOException{ test x = new test(); x.authenticate(); } }