Seems to be an issue here: else if((a==b)&&(b==c)){ System.out.println(a+" "+b+" "+c); }