Sobes.tech
Junior — Senior

Find the two largest elements of the array

livecode

Task condition

Create a method that takes an arbitrary number of integers via varargs and returns the two maximum values. Use only basic language constructs. The result should be represented as an array in the form [firstMax, secondMax].

private static int[] getTwoMax(int... numbers) {
    // return the maximum two numbers from an array of numbers e.g. [firstMax, secondMax]
}