import java.util.ArrayList;
import java.util.Scanner;

/**
   This program reads a sequence of values and prints them, marking the largest value.
*/
public class LargestInArrayList
{
   public static void main(String[] args)
   {  
      ArrayList<Double> data = new ArrayList<Double>();

      // Read inputs

      System.out.println("Please enter values, Q to quit:");
      Scanner in = new Scanner(System.in);
      while (in.hasNextDouble())
      {  
         data.add(in.nextDouble());
      }

      // Find the largest value

      double largest = data.get(0);
      for (int i = 1; i < data.size(); i++)
      {
         if (data.get(i) > largest)
         {
            largest = data.get(i);
         }
      }

      // Print all values, marking the largest

      for (double element : data)
      {  
         System.out.print(element);
         if (element == largest) 
         {
            System.out.print(" <== largest value");
         }
         System.out.println();
      }
   }
}
