Find biggest number array

Find biggest number array

Below is sample java program to find biggest number array. To find biggest number in int array using java below has shown two simple logic to use:

package com.javahonk;

import java.util.Arrays;

public class FindBigestValueInArray {

	public static void main(String[] args) {

		System.out.println("Example logic 1:");
		int value[]={1,49,3,2};
		for (int i = 0; i < value.length; i++) {
			if (value[i]>value[0]) {
				value[0]=value[i];
			}
		}

		System.out.println(value[0]);

		System.out.println("Example logic 2:");
		Arrays.sort(value);
		System.out.println(value[value.length-1]);

	}

}

Leave a Reply

Your email address will not be published. Required fields are marked *