0

I have figured out how to return the largest integer of my array.

int[] a = new int[] { 2, 22, 4, 6745, 45, 999, 1000, 1, 5747, 454 };

public int method(int[] a) { 
  int max = Arrays.stream(a).max().getAsInt();
  return max;
}

However, I still did not find a way to reutnr the largest TWO integers. Could you help my out? I am still a beginner, so make it simple pls :)

Andy Turner
  • 137,514
  • 11
  • 162
  • 243

0 Answers0