So, I'm making a little game in Java for 'fun'. I want to make it so the two players can guess a number 0-100, and whoever gets closest to the random number generated wins the chest.

So far I have....

Random r = new Random();
		int chest = r.nextInt(101);
		System.out.println("Player 1, guess the random number (from 0 - 100)");
		p1_guess = input.nextInt();
		System.out.println("Player 2, guess the random number (from 0 - 100)");
		p2_guess = input.nextInt();
		int p1_answer = p1_guess - chest; //subtracts player 1's guess from the random number
		int p2_answer = p2_guess - chest;
		 p1_answer = Math.abs(p1_answer); //finds the absolute value 
		 p2_answer = Math.abs(p2_answer);
And then the logic comes in, and my brain is fried...
I guess I need to compare the p2_answer and P1_answer and see what is smallest? I'm not really sure how to do that or if that's even what I have to do.

Any help would be very, very helpful.

Thank you,