title: Finding the minimum of a set of inputs
body: <p>I've been given Pseudo code to translate into a Java program. </p>
  
  <p>It is as follows:</p>
  
  <ul>
  <li><p>Set a Boolean variable “first” to true. </p></li>
  <li><p>While another value has been read successfully </p>
  
  <ul>
  <li>If first is true 
  <ul>
  <li>Set the minimum to the value just read </li>
  <li>Set first to false </li>
  </ul></li>
  <li>Else if the value is less than the minimum 
  <ul>
  <li>Set the minimum to the value </li>
  </ul></li>
  <li>Print the minimum</li>
  </ul></li>
  </ul>
  
  <p>So far I have this:</p>
  
  <pre><code>import java.util.Scanner;
  public class InputLoop
  {
      public static void main(String[] args)
      {
      Scanner scan = new Scanner(System.in);
      System.out.println("Enter an integer");
  
      boolean first = true;
      int min = 0;
      int val = 0;
  
      while (scan.hasNextInt())
      {
          val = scan.nextInt();
          System.out.println("Enter an integer");
          if (first == true) 
          {
              min = val;
              first = false;
          } 
  
          else if (val &lt; min) 
          {
              System.out.println("Enter an integer");
              min = val;
  
          }
  
          while (!scan.hasNextInt())
          {
              System.out.println (("The minimum value is") + (min));
              break;
          }
      }
  }
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated as I'm stumped!</p>
  
  <p>Thanks.</p>