Find Largest Number in an Array Using Java

The following Java program finds the largest number in a given array. Initially the largest variable value is set as the smallest integer value (Integer.MIN_VALUE) and whenever a bigger number is found in array, it is overwritten with the new value. We iterate through the entire array with the above logic to find the largest number.

Print the Largest Number in an Array Using Java

// Java program to find largest number in an array
public class FindLargest {
    public static void main(String[] args) {
        int[] numbers = {88,33,55,23,64,123};
        int largest = Integer.MIN_VALUE;
        for(int i =0;i<numbers.length;i++) {
            if(numbers[i] > largest) {
                largest = numbers[i];
        System.out.println("Largest number in array is : " +largest);