For my CS class I have to write a HiLo game using multithreading.  I am brand new to multithreading and not sure how to best implement it.  The program below works, but I am wondering if there is a better way to do it.  When it is run the user will input an int, which is the amount of time that they will have to guess the correct number.  If the timer runs out the game will end.  I am not supposed to use the Timer object but instead use the System.currentTimeMillis().    import java.util.Random;import java.util.Scanner;class Game implements Runnable {    private static long time;    private long timer;    private static long gameTime;    public Game(int n){        gameTime=n;    }    public void run() {        time=System.currentTimeMillis();        while(true){            timer=(System.currentTimeMillis()-time)/1000;            if(timer>=gameTime){                System.out.println(Oops! Time is up - try again.);                break;            }        }    }}public class Hilo {    public static void main(String[] args) {        if (args.length!=1){            System.err.println(Must enter time);        }        Random rand = new Random();        int max=100;        int min=1;        int number=rand.nextInt((max-min)+1)+min;        int gameTime=Integer.parseInt(args[0]);        System.out.println(Welcome to HiLo!);        System.out.println(You have +gameTime+ seconds to guess a number between 1 and 100.);        Thread clock1 = new Thread(new Game(gameTime));        clock1.start();        while(clock1.isAlive()==true){            System.out.println(>);            Scanner sc = new Scanner(System.in);            int input = sc.nextInt();            if(clock1.isAlive()==true&&input==number){                System.out.println(You Win!);                break;            }else if(clock1.isAlive()==true&&input<number){                System.out.println(Higher!);            }else if(clock1.isAlive()==true&&input>number){                System.out.println(Lower!);            }           }    }}
Multithreaded HiLo game
java;game;multithreading;timer