How can I find the index of an array element? <p>I have this class and it displays the value of arrays after preferred input:</p> <pre><code>class MyArrayList { private int [] myArray; private int size; public MyArrayList (int value, int seed, int inc){ myArray = new int [value]; size = value; for (int i = 0; i &lt; size; i++) { myArray [i] = seed; seed += inc; } } } public class JavaApp1 { public static void main(String[] args) { MyArrayList a = new MyArrayList(5, 2, 1); a.printList(); } } </code></pre> <p>this program displays an output of: 2 3 4 5 6 now I want to find the index of 4 so that would be 2 but how can I put it into program?</p>