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.  
  11. static int findHighest(int[] arr, int size) {
  12. int highest = Integer.MIN_VALUE;
  13. if(size == -1) {
  14. return highest;
  15. } else if(arr[size] > highest) {
  16. highest = arr[size];
  17. }
  18. return findHighest(arr,size-1);
  19. }
  20.  
  21. public static void main (String[] args) throws java.lang.Exception
  22. {
  23. int[] arr = {5,38,4,10,25,3,55};
  24. System.out.println(findHighest(arr,6));
  25. }
  26. }
Success #stdin #stdout 0.05s 2184192KB
stdin
Standard input is empty
stdout
-2147483648