取最大值

@param <T> 元素类型
@param numberArray 数字数组
@return 最大值
@since 3.0.9
542506
public static <T extends Comparable<? super T>> T max(T[] numberArray) {
		if (isEmpty(numberArray)) {
			throw new IllegalArgumentException("Number array must not empty !");
		}
		T max = numberArray[0];
		for (int i = 0; i < numberArray.length; i++) {
			if (ObjectUtil.compare(max, numberArray[i]) < 0) {
				max = numberArray[i];
			}
		}
		return max;
	}
830611
public static AssociativeArray sortAssociativeArrayByValueAscending(AssociativeArray associativeArray) {
        ArrayList<Map.Entry<Object, Object>> entries = new ArrayList<>(associativeArray.entrySet());
        Collections.sort(entries, (Map.Entry<Object, Object> a, Map.Entry<Object, Object> b) -> {
            Double va = TypeInference.toDouble(a.getValue());
            Double vb = TypeInference.toDouble(b.getValue());
            return va.compareTo(vb);
        });
        
        AssociativeArray sortedAssociativeArray = new AssociativeArray();
        for (Map.Entry<Object, Object> entry : entries) {
          sortedAssociativeArray.put(entry.getKey(), entry.getValue());
        }
        
        return sortedAssociativeArray;
    }
594236
static public int asInt(byte[] array) {

        if (null == array || 4 != array.length) {
            throw new IllegalArgumentException("Length of the byte array should be 4");
        }

        return ((array[0] << 24)
                + ((array[1] & 255) << 16)
                + ((array[2] & 255) << 8) + (array[3] & 255));
    }
303281
public static int search(long[] longArray, long value) { 
        int start = 0;
        int end = longArray.length - 1;
        int middle = 0;
        
        while(start <= end) {
            middle = (start + end) >> 1;
        
            if(value == longArray[middle]) {
                return middle;
            }
            
            if(value < longArray[middle]) {
                end = middle - 1 ;
            }
            else {
                start = middle + 1;
            }
        }
                

        return -1;
    }
906512
public int[] asArray() {
	    int arr[] = new int[size()];
	    OrdinalIterator iter = iterator();
	    
	    int ordinal = iter.nextOrdinal();
	    int i = 0;

	    while(ordinal != NO_MORE_ORDINALS) {
	        arr[i++] = ordinal;
	        ordinal = iter.nextOrdinal();
	    }
	    
	    return arr;
	}
193414
public static <A> double[] toPrimitiveDoubleArray(A array, NumberArrayAdapter<?, ? super A> adapter) {
    if (adapter == DOUBLEARRAYADAPTER) {
      return ((double[]) array).clone();
    }
    double[] ret = new double[adapter.size(array)];
    for (int i = 0; i < ret.length; i++) {
      ret[i] = adapter.getDouble(array, i);
    }
    return ret;
  }
240098
public PactDslJsonArray numberType() {
      generators.addGenerator(Category.BODY, rootPath + appendArrayIndex(1), new RandomIntGenerator(0, Integer.MAX_VALUE));
      return numberType(100);
    }
1144530
public static void sort(long[] longArray) {
        int index = 0;
        long value = 0;
        
        for(int i = 1; i < longArray.length; i++) {
            index = i;
            value = longArray[index];
            
            while(index > 0 && value < longArray[index - 1]) {
                longArray[index] = longArray[index - 1];
                
                index--;
            }
            
            longArray[index] = value;
        }
    }
1252631
public static <A> int[] toPrimitiveIntegerArray(A array, NumberArrayAdapter<?, ? super A> adapter) {
    int[] ret = new int[adapter.size(array)];
    for (int i = 0; i < ret.length; i++) {
      ret[i] = adapter.getInteger(array, i);
    }
    return ret;
  }
1127242
public static int[] toInt(double[] array) {
        int[] n = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            n[i] = (int) array[i];
        }
        return n;
    }
1332953
public static int min(IntArrayND array)
    {
        return array.stream().parallel().reduce(
            Integer.MAX_VALUE, Math::min);
    }
921004
public static void sortDescending(long[] longArray) {
        int index = 0;
        long value = 0;
        
        for(int i = 1; i < longArray.length; i++) {
            index = i;
            value = longArray[index];
            
            while(index > 0 && value > longArray[index - 1]) {
                longArray[index] = longArray[index - 1];
                
                index--;
            }
            
            longArray[index] = value;
        }
    }
1137926
public static int[][] toInt(double[][] array) {
        int[][] n = new int[array.length][array[0].length];
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[0].length; j++) {
                n[i][j] = (int) array[i][j];
            }
        }
        return n;
    }
892116
public static <T> int indexOf(T[] objectArray, T elem)
    {
        return InternalArrayIterate.indexOf(objectArray, objectArray.length, elem);
    }
1359276
function getNumElementsFromNonIndexedArrays(arrays) {
    var key = Object.keys(arrays)[0];
    var array = arrays[key];
    if (isArrayBuffer(array)) {
      return array.numElements;
    } else {
      return array.data.length / array.numComponents;
    }
  }
869650
public static double searchMax(double[] doubleArray) {
        if(doubleArray.length == 0) {
            throw new IllegalArgumentException("The array you provided does not have any elements");
        }

        double max = doubleArray[0];

        for(int i = 1; i < doubleArray.length; i++) {
            if(doubleArray[i] > max) {
                max = doubleArray[i];
            }
        }

        return max;
    }
700602
public static <A> double[] toPrimitiveDoubleArray(A data, NumberArrayAdapter<?, A> adapter) {
    if(adapter == DoubleArrayAdapter.STATIC) {
      return ((double[]) data).clone();
    }
    final int len = adapter.size(data);
    double[] x = new double[len];
    for(int i = 0; i < len; i++) {
      x[i] = adapter.getDouble(data, i);
    }
    return x;
  }