Here you can find the source of max(byte[] values)
Parameter | Description |
---|---|
values | the array to search |
public static final byte max(byte[] values)
//package com.java2s; //License from project: Open Source License public class Main { /** Get the maximum value in an array subset * @param values the array to search * @return the minimum value found in the array subset specified *///from w ww .ja v a 2s. c o m public static final byte max(byte[] values) { return max(values, 0, values.length); } /** Get the maximum value in an array subset * @param values the array to search * @param offset the offset into the array at which to start searching * @param length the number of values to search * @return the minimum value found in the array subset specified */ public static final byte max(byte[] values, int offset, int length) { byte max = Byte.MIN_VALUE; int offLen = offset + length; for (int i = offset; i < offLen; i++) { if (max < values[i]) { max = values[i]; } } return max; } /** Get the maximum value in an array subset * @param values the array to search * @return the minimum value found in the array subset specified */ public static final short max(short[] values) { return max(values, 0, values.length); } /** Get the maximum value in an array subset * @param values the array to search * @param offset the offset into the array at which to start searching * @param length the number of values to search * @return the minimum value found in the array subset specified */ public static final short max(short[] values, int offset, int length) { short max = Short.MIN_VALUE; int offLen = offset + length; for (int i = offset; i < offLen; i++) { if (max < values[i]) { max = values[i]; } } return max; } /** Get the maximum value in an array subset * @param values the array to search * @return the minimum value found in the array subset specified */ public static final char max(char[] values) { return max(values, 0, values.length); } /** Get the maximum value in an array subset * @param values the array to search * @param offset the offset into the array at which to start searching * @param length the number of values to search * @return the minimum value found in the array subset specified */ public static final char max(char[] values, int offset, int length) { char max = Character.MIN_VALUE; int offLen = offset + length; for (int i = offset; i < offLen; i++) { if (max < values[i]) { max = values[i]; } } return max; } /** Get the maximum value in an array subset * @param values the array to search * @return the minimum value found in the array subset specified */ public static final int max(int[] values) { return max(values, 0, values.length); } /** Get the maximum value in an array subset * @param values the array to search * @param offset the offset into the array at which to start searching * @param length the number of values to search * @return the minimum value found in the array subset specified */ public static final int max(int[] values, int offset, int length) { int max = Integer.MIN_VALUE; int offLen = offset + length; for (int i = offset; i < offLen; i++) { if (max < values[i]) { max = values[i]; } } return max; } /** Get the maximum value in an array subset * @param values the array to search * @return the minimum value found in the array subset specified */ public static final long max(long[] values) { return max(values, 0, values.length); } /** Get the maximum value in an array subset * @param values the array to search * @param offset the offset into the array at which to start searching * @param length the number of values to search * @return the minimum value found in the array subset specified */ public static final long max(long[] values, int offset, int length) { long max = Long.MIN_VALUE; int offLen = offset + length; for (int i = offset; i < offLen; i++) { if (max < values[i]) { max = values[i]; } } return max; } /** Get the maximum value in an array subset * @param values the array to search * @return the minimum value found in the array subset specified */ public static final float max(float[] values) { return max(values, 0, values.length); } /** Get the maximum value in an array subset * @param values the array to search * @param offset the offset into the array at which to start searching * @param length the number of values to search * @return the minimum value found in the array subset specified */ public static final float max(float[] values, int offset, int length) { float max = Float.MIN_VALUE; int offLen = offset + length; for (int i = offset; i < offLen; i++) { if (max < values[i]) { max = values[i]; } } return max; } /** Get the maximum value in an array subset * @param values the array to search * @return the minimum value found in the array subset specified */ public static final double max(double[] values) { return max(values, 0, values.length); } /** Get the maximum value in an array subset * @param values the array to search * @param offset the offset into the array at which to start searching * @param length the number of values to search * @return the minimum value found in the array subset specified */ public static final double max(double[] values, int offset, int length) { double max = Double.MIN_VALUE; int offLen = offset + length; for (int i = offset; i < offLen; i++) { if (max < values[i]) { max = values[i]; } } return max; } }