title: minimum value in java won't work
body: <p>I need help because my brain cells cannot find what is wrong with this program! 
  Here's the code</p>
  
  <pre><code>     import java.util.*;
        public class student{
        public static void main (String []args)
  
      { 
          Scanner sc=new Scanner(System.in);
          System.out.println("enter number elements");  //asking the user to enter the number of integer items 
          int num=sc.nextInt();
          int []myArray= new int[num];
          int maxValue=myArray[0];
          int minValue=myArray[0];
          int i;
          for( i=0; i&lt;myArray.length;i++)
          {System.out.print("Enter element"+(i+1));  //asking the user to enter the items 
             myArray[i]=sc.nextInt();
          }
  
          for(i=0; i&lt;myArray.length;i++)
          {System.out.print(myArray[i]);    //displaying the elements 
          }
          System.out.println(" ");
          for( i=myArray.length-1; i&gt;=0;i--)
          {System.out.print(myArray[i]);      //displaying the elements in a backward order
          }
          System.out.println(" ");
          for( i=0; i&lt;myArray.length;i++)
          {if(i%2==1)
  
             System.out.println(myArray[i]);               //displaying the elements in odd indices
  
          }
  
        for( i=0; i&lt;myArray.length-1;i++)
          { if(myArray[i]&gt;maxValue)
              {
                  maxValue= myArray[i];           //finding the maximum
  
  
              }
  
          }
          System.out.println(maxValue+" "+(i+1));
  
          for( i=1; i&lt;myArray.length-1;i++)
          { if( myArray[i]&lt;minValue)
              {minValue= myArray[i];                //finding the minimum
  
              }
          }
         System.out.println(+minValue+" "+(i+1));
  
  
  
          System.out.println(myArray[0]);                          //displaying first item
          System.out.println( myArray[myArray.length-1]);          //displaying last item
  
  
  
  
          for( i=0; i&lt;myArray.length;i++)
          {if(i%2==0)
  
            {  myArray[i]= myArray[i]*-1;                    //multiplying items in even indices by -1
  
          System.out.print( myArray[i]);}
      }
    }
  
  }
  </code></pre>
  
  <p>The program does what's in the comment, yet the minimum value is always zero even if I don't enter it...I cannot figure out what's the problem, so I'd appreciate your help!</p>