Here you can find the source of min(long[] array)
public static long min(long[] array)
//package com.java2s; //License from project: Mozilla Public License public class Main { public static long min(long[] array) { if (array == null) { throw new IllegalArgumentException("The Array must not be null"); } else if (array.length == 0) { throw new IllegalArgumentException("Array cannot be empty."); }/*from w ww. ja va2 s. co m*/ long min = array[0]; for (int i = 1; i < array.length; i++) { if (array[i] < min) { min = array[i]; } } return min; } public static int min(int[] array) { if (array == null) { throw new IllegalArgumentException("The Array must not be null"); } else if (array.length == 0) { throw new IllegalArgumentException("Array cannot be empty."); } int min = array[0]; for (int j = 1; j < array.length; j++) { if (array[j] < min) { min = array[j]; } } return min; } public static short min(short[] array) { if (array == null) { throw new IllegalArgumentException("The Array must not be null"); } else if (array.length == 0) { throw new IllegalArgumentException("Array cannot be empty."); } short min = array[0]; for (int i = 1; i < array.length; i++) { if (array[i] < min) { min = array[i]; } } return min; } public static byte min(byte[] array) { if (array == null) { throw new IllegalArgumentException("The Array must not be null"); } else if (array.length == 0) { throw new IllegalArgumentException("Array cannot be empty."); } byte min = array[0]; for (int i = 1; i < array.length; i++) { if (array[i] < min) { min = array[i]; } } return min; } public static double min(double[] array) { if (array == null) { throw new IllegalArgumentException("The Array must not be null"); } else if (array.length == 0) { throw new IllegalArgumentException("Array cannot be empty."); } double min = array[0]; for (int i = 1; i < array.length; i++) { if (Double.isNaN(array[i])) { return Double.NaN; } if (array[i] < min) { min = array[i]; } } return min; } public static float min(float[] array) { if (array == null) { throw new IllegalArgumentException("The Array must not be null"); } else if (array.length == 0) { throw new IllegalArgumentException("Array cannot be empty."); } float min = array[0]; for (int i = 1; i < array.length; i++) { if (Float.isNaN(array[i])) { return Float.NaN; } if (array[i] < min) { min = array[i]; } } return min; } public static long min(long a, long b, long c) { if (b < a) { a = b; } if (c < a) { a = c; } return a; } public static int min(int a, int b, int c) { if (b < a) { a = b; } if (c < a) { a = c; } return a; } public static short min(short a, short b, short c) { if (b < a) { a = b; } if (c < a) { a = c; } return a; } public static byte min(byte a, byte b, byte c) { if (b < a) { a = b; } if (c < a) { a = c; } return a; } public static double min(double a, double b, double c) { return Math.min(Math.min(a, b), c); } public static float min(float a, float b, float c) { return Math.min(Math.min(a, b), c); } }