How can I use a for loop to return the index number of the location of the integer I want to find? For example, in the array above, if the number to “find” is 9, the program should return the index number “5” in a user-friendly phrase.
import javax.swing.JOptionPane;
public class ComparingStrings
{
   public static void main( String[] args )
   {
       int [] array = {-9, 2, 3, 4, 7, 9, 10, 23, 45, 67};
       int index = -1;
       for(int i = 0; i < array.length; i++)
       {
            System.out.print(array[i] + " ");            
       }
       System.out.print( "\n" );
       for(int i = array.length - 1; i > 0; i--)
       {
           System.out.print(array[i] + " ");          
       }
       System.out.print( "\n" );
       String statement = JOptionPane.showInputDialog( "Type the integer which you want to find the location of" );
       int interger = Integer.parseInt(statement);
       System.out.println( "Integer:" + interger );
       for(int i = array.length - 1; i >= 0; i--)
       {
           if( statement .equals (array[i]))
           {
               index = i;
               System.out.println( "Index of Integer is: " + i);
           }
           else
           {
               System.out.println( "Index of Interger is: -1" );
           }
       }
    }//end method main
}//end class ComparingStrings
 
    