Mastermind game
<p>I'm a beginner in java programming. Now I'm doing a game called mastermind.</p>

<p>It has many conditions and I'm using numbers instead of colours.</p>

<p>I have no idea of how to solve this problem: I'm using if else statement to do my game but if the solution is 4444 and user input is 4444, the output answer is wrong.</p>

<p>In this game the first input is computer generated, but i have to test the program, so i set the number by myself, and the second input is the player input.</p>

<p>Here is the code i've done:</p>

<pre><code>import javax.swing.JOptionPane;


public class asd {


    public static void main (String args[]){
        int i,j;
        int b=0 ,w=0;

    String input[] = new String[4];
    input[0] = JOptionPane.showInputDialog("input a digit");
    input[1] = JOptionPane.showInputDialog("input a digit");
    input[2] = JOptionPane.showInputDialog("input a digit");
    input[3] = JOptionPane.showInputDialog("input a digit");

     String Uinput[] = new String[4];
     Uinput[0] = JOptionPane.showInputDialog("input a digit");
     Uinput[1] = JOptionPane.showInputDialog("input a digit");
     Uinput[2] = JOptionPane.showInputDialog("input a digit");
     Uinput[3] = JOptionPane.showInputDialog("input a digit");

     for(i=0;i&lt;4;i++){
        for(j=0;j&lt;4;j++){
            if(i&lt;4){
            if(input[i].equals(Uinput[j])){
                if(i==j){
                    b++;
                    i++;
                    j=0;
                }else{
                    w++;


                }
            }
            }
        }
     }
     System.out.println("black = "+b+"\nwhite = "+w);

}
}
</code></pre>
