java array outofboundexception <pre><code>public static int[] squeeze(int[] ints) { int i; int[] temp; temp = new int[100]; for (i = 0; i &lt; ints.length; i++) { if (ints[i] != ints[i + 1]) { temp[i] = ints[i]; } else{ while (ints[i] != ints[i + 1]) { i++; } temp[i] = ints[i]; } } return temp; } </code></pre> <p>When I run this code, it gives me arrayOutOfBoundException. Can any body point the error? I am basically checking that no two consecutive numbers in an array are the same and then printing the same array but with a copy of the next number if two consecutive are same.</p>