Guest User

Untitled

a guest
Jan 16th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1.     public static double[] getMaxArray1(double[] inputArray)
  2.     {
  3.         double[] maxArray = new double[inputArray.length];
  4.         double max = inputArray[0];
  5.         int count = 1;
  6.        
  7.         for(int i = 0; i < inputArray.length; i++)
  8.         {
  9.             if(inputArray[i] > max)
  10.             {
  11.                 max = inputArray[i];
  12.                 count = 1;
  13.                 maxArray[0] = max;
  14.             }
  15.             else if(max == inputArray[i])
  16.             {
  17.                 maxArray[count] = max;
  18.                 count++;
  19.             }
  20.         }
  21.        
  22.         return maxArray;
  23.     }
Add Comment
Please, Sign In to add comment