main.java
//Function to return every index a value is at
Function to return every index a value is at
Function to return every index a value is at
public static ArrayList<Integer> IndexCollect(int[] array,int value){
        ArrayList<Integer> indexes =new ArrayList<Integer>();
        for (int x=0; x<array.length;x++){
            if(array[x]==value){
                indexes.add(x);
            }
        }
        return indexes;
    }
public static ArrayList < Integer > IndexCollect ( int [ ] array , int value ) { ArrayList < Integer > indexes = new ArrayList < Integer > ( ) ; for ( int x = 0 ; x < array . length ; x ++ ) { if ( array [ x ] == value ) { indexes . add ( x ) ; } } return indexes ; }
Function to return every index a value is at
Function to return every index a value is at
//creating arraylist //loop for length of array //if array equals value append index to list //return list