diff --git a/src/main/java/com/thealgorithms/maths/FindMax.java b/src/main/java/com/thealgorithms/maths/FindMax.java index 8587e3ab..76bde5ff 100644 --- a/src/main/java/com/thealgorithms/maths/FindMax.java +++ b/src/main/java/com/thealgorithms/maths/FindMax.java @@ -1,26 +1,7 @@ package com.thealgorithms.maths; -import java.util.Arrays; -import java.util.Random; - -public class FindMax { - - /** - * Driver Code - */ - public static void main(String[] args) { - Random random = new Random(); - - /* random size */ - int size = random.nextInt(100) + 1; - int[] array = new int[size]; - - /* init array with random numbers */ - for (int i = 0; i < size; i++) { - array[i] = random.nextInt() % 100; - } - - assert Arrays.stream(array).max().getAsInt() == findMax(array); +public final class FindMax { + private FindMax() { } /** @@ -30,7 +11,7 @@ public class FindMax { * @exception IllegalArgumentException input array is empty * @return the maximum value stored in the input array */ - public static int findMax(int[] array) { + public static int findMax(final int[] array) { if (array.length == 0) { throw new IllegalArgumentException("array must be non-empty."); }