Java rock paper scissors loop
<p>I'm having to make a paper rock scissors program that has the user enter in a choice, then tests it against the computer's choice. After every game, it should ask the player if they want to continue, and they should enter in 'Y' or 'N' to continue or quit. The best I could think was a while loop, and everything works fine except the very last bit.</p>

<pre><code>import java.util.Scanner;

public class rockpaperscissors {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        char cont = 'y';

        while (cont == 'y'){        
            int com = (int)(Math.random() * 3);

            System.out.println("Paper (0), Rock (1), or Scizzors (2)?");
            int hum = input.nextInt();

            if (com==(hum))  
                System.out.println("It's a tie!");

            else if (hum == 0)
            {
                if (com == 1)
                    System.out.println ("You chose paper, computer chose rock You Win!");
                else if (com == 2)
                    System.out.println ("You chose paper, Computer chose scissors You Lose!");
            }

            else if (hum == 1)
            {
                if (com == 2)
                    System.out.println ("You chose Rock, computer chose scissors You Win!");
                else if (com == 0)
                    System.out.println ("You chose Rock, Computer chose paper You Lose!");
            }

            else if (hum == 2)
            {
                if (com == 0)
                    System.out.println ("You chose Scissors, computer chose paper You Win!");
                else if (com == 1)
                    System.out.println ("You chose Scissors, Computer chose rock You Lose!");
            }

            System.out.println("Would you like to continue? (Y/N)");
            cont = input.nextLine().charAt(0);
        }       
    }
}
</code></pre>

<p>When I run it, the loop runs fine, the game is played, but then I get a 'string out of index range' error. Any idea how to resolve this?</p>
