fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static int getNumberOfMaxParam(int... values) {
  11. if (values.length == 0) return 0;
  12.  
  13. int highestIndex = 1;
  14. int currentMax = values[0];
  15. for (int i = 1; i < values.length; i++) {
  16. if (values[i] > currentMax) {
  17. currentMax = values[i];
  18. highestIndex = i + 1;
  19. }
  20. }
  21. return highestIndex;
  22. }
  23.  
  24. public static void main (String[] args) throws java.lang.Exception
  25. {
  26. System.out.print(getNumberOfMaxParam(1, 7, 8));
  27. }
  28. }
Success #stdin #stdout 0.06s 32348KB
stdin
Standard input is empty
stdout
3