Finding Biggest Number


This program finds the biggest number in an array of the integer. Array of Integer is sorted using sort method of Arrays class that sorts the elements in natural order (Integer-ascending order). As the sort method is static the input array is modified instead of creating new array. Hence the last element of the array gives the biggest number.

  • Filename:

import java.util.*;
class Biggest {
public static void main(String args[]) {
//Sorting Integer in natural order
int n[] = {40,20,99,65,74};
System.out.println("Sorted list of Integer");
for(int i:n) {
int l=n.length;
int biggestNumber = n[l-1];
System.out.println("Biggest number="+biggestNumber);