Class JArrays

java.lang.Object
net.algart.arrays.JArrays

public class JArrays extends Object

Some operations for Java array manipulation, in addition to java.util.Arrays.

This class cannot be instantiated.

Author:
Daniel Alievsky
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Implementation of ArrayExchanger, that simultaneously exchanges two pairs elements at the same positions in two arrays: some byte[] array and some int[] array.
    static class 
    Simple implementation of ArrayComparator, comparing elements of byte[] array.
    static class 
    Simple implementation of ArrayExchanger, exchanging elements of byte[] array.
    static class 
    Implementation of ArrayExchanger, that simultaneously exchanges two pairs elements at the same positions in two arrays: some char[] array and some int[] array.
    static class 
    Simple implementation of ArrayComparator, comparing elements of char[] array.
    static class 
    Simple implementation of ArrayExchanger, exchanging elements of char[] array.
    static class 
    Implementation of ArrayExchanger, that simultaneously exchanges two pairs elements at the same positions in two arrays: some double[] array and some int[] array.
    static class 
    Simple implementation of ArrayComparator, comparing elements of double[] array.
    static class 
    Simple implementation of ArrayExchanger, exchanging elements of double[] array.
    static class 
    Implementation of ArrayExchanger, that simultaneously exchanges two pairs elements at the same positions in two arrays: some float[] array and some int[] array.
    static class 
    Simple implementation of ArrayComparator, comparing elements of float[] array.
    static class 
    Simple implementation of ArrayExchanger, exchanging elements of float[] array.
    static class 
    Implementation of ArrayExchanger, that simultaneously exchanges two pairs elements at the same positions in two arrays: some int[] array and some int[] array.
    static class 
    Simple implementation of ArrayComparator, comparing elements of int[] array.
    static class 
    Simple implementation of ArrayExchanger, exchanging elements of int[] array.
    static class 
    Implementation of ArrayExchanger, that simultaneously exchanges two pairs elements at the same positions in two arrays: some long[] array and some int[] array.
    static class 
    Simple implementation of ArrayComparator, comparing elements of long[] array.
    static class 
    Simple implementation of ArrayExchanger, exchanging elements of long[] array.
    static class 
    Implementation of ArrayExchanger, that simultaneously exchanges two pairs elements at the same positions in two arrays: some short[] array and some int[] array.
    static class 
    Simple implementation of ArrayComparator, comparing elements of short[] array.
    static class 
    Simple implementation of ArrayExchanger, exchanging elements of short[] array.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean[]
    Constant, containing empty array new boolean[0].
    static final byte[]
    Constant, containing empty array new byte[0].
    static final char[]
    Constant, containing empty array new char[0].
    static final double[]
    Constant, containing empty array new double[0].
    static final float[]
    Constant, containing empty array new float[0].
    static final int[]
    Constant, containing empty array new int[0].
    static final long[]
    Constant, containing empty array new long[0].
    static final short[]
    Constant, containing empty array new short[0].
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    absDiffOfByteArray(byte[] dest, int destPos, byte[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
    static void
    absDiffOfCharArray(char[] dest, int destPos, char[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
    static void
    absDiffOfDoubleArray(double[] dest, int destPos, double[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
    static void
    absDiffOfFloatArray(float[] dest, int destPos, float[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
    static void
    absDiffOfIntArray(int[] dest, int destPos, int[] src, int srcPos, int count, boolean truncateOverflows)
    Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
    static void
    absDiffOfLongArray(long[] dest, int destPos, long[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
    static void
    absDiffOfShortArray(short[] dest, int destPos, short[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
    static void
    addByteArray(double[] dest, int destPos, byte[] src, int srcPos, int count, double mult)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]&0xFF)*mult.
    static void
    addByteArray(int[] dest, int destPos, byte[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]&0xFF).
    static void
    addCharArray(double[] dest, int destPos, char[] src, int srcPos, int count, double mult)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i])*mult.
    static void
    addCharArray(int[] dest, int destPos, char[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]).
    static void
    addDoubleArray(double[] dest, int destPos, double[] src, int srcPos, int count, double mult)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i])*mult.
    static void
    addDoubleArray(int[] dest, int destPos, double[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]).
    static void
    addFloatArray(double[] dest, int destPos, float[] src, int srcPos, int count, double mult)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i])*mult.
    static void
    addFloatArray(int[] dest, int destPos, float[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]).
    static void
    addIntArray(double[] dest, int destPos, int[] src, int srcPos, int count, double mult)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i])*mult.
    static void
    addIntArray(int[] dest, int destPos, int[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]).
    static void
    addLongArray(double[] dest, int destPos, long[] src, int srcPos, int count, double mult)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i])*mult.
    static void
    addLongArray(int[] dest, int destPos, long[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]).
    static void
    addShortArray(double[] dest, int destPos, short[] src, int srcPos, int count, double mult)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]&0xFFFF)*mult.
    static void
    addShortArray(int[] dest, int destPos, short[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]&0xFFFF).
    static boolean
    areElementsZero(Object array, int pos, int count)
    Returns true if the specified fragment of the passed Java array is filled by zero (false for boolean[] array, (char)0 for char[], null for non-primitive element type).
    static boolean
    arrayEquals(Object array1, int pos1, Object array2, int pos2, int length)
    Returns true if the arguments are Java arrays and their specified fragments are equals, or if both arguments are null.
    static int
    arrayHashCode(Object array, int fromIndex, int toIndex)
    Returns a hash code based on the contents of the specified fragment of the given array.
    static boolean[]
    copyOfRange(boolean[] array, int fromIndex, int toIndex)
    Equivalent to (boolean[])copyOfRange(array, fromIndex, toIndex).
    static byte[]
    copyOfRange(byte[] array, int fromIndex, int toIndex)
    Equivalent to (byte[])copyOfRange(array, fromIndex, toIndex).
    static char[]
    copyOfRange(char[] array, int fromIndex, int toIndex)
    Equivalent to (char[])copyOfRange(array, fromIndex, toIndex).
    static double[]
    copyOfRange(double[] array, int fromIndex, int toIndex)
    Equivalent to (double[])copyOfRange(array, fromIndex, toIndex).
    static float[]
    copyOfRange(float[] array, int fromIndex, int toIndex)
    Equivalent to (float[])copyOfRange(array, fromIndex, toIndex).
    static int[]
    copyOfRange(int[] array, int fromIndex, int toIndex)
    Equivalent to (int[])copyOfRange(array, fromIndex, toIndex).
    static long[]
    copyOfRange(long[] array, int fromIndex, int toIndex)
    Equivalent to (long[])copyOfRange(array, fromIndex, toIndex).
    static short[]
    copyOfRange(short[] array, int fromIndex, int toIndex)
    Equivalent to (short[])copyOfRange(array, fromIndex, toIndex).
    static Object
    copyOfRange(Object array, int fromIndex, int toIndex)
    Returns a fragment of the given array from the element #fromIndex to the element #toIndex.
    static void
    fillBooleanArray(boolean[] dest, boolean value)
    Fills all elements in the dest array by the specified value.
    static void
    fillBooleanArray(boolean[] dest, int destPos, int count, boolean value)
    Fills count elements in the dest array, starting from the element #destPos, by the specified value.
    static void
    fillByteArray(byte[] dest, byte value)
    Fills all elements in the dest array by the specified value.
    static void
    fillByteArray(byte[] dest, int destPos, int count, byte value)
    Fills count elements in the dest array, starting from the element #destPos, by the specified value.
    static void
    fillCharArray(char[] dest, char value)
    Fills all elements in the dest array by the specified value.
    static void
    fillCharArray(char[] dest, int destPos, int count, char value)
    Fills count elements in the dest array, starting from the element #destPos, by the specified value.
    static void
    fillDoubleArray(double[] dest, double value)
    Fills all elements in the dest array by the specified value.
    static void
    fillDoubleArray(double[] dest, int destPos, int count, double value)
    Fills count elements in the dest array, starting from the element #destPos, by the specified value.
    static void
    fillFloatArray(float[] dest, float value)
    Fills all elements in the dest array by the specified value.
    static void
    fillFloatArray(float[] dest, int destPos, int count, float value)
    Fills count elements in the dest array, starting from the element #destPos, by the specified value.
    static void
    fillIntArray(int[] dest, int value)
    Fills all elements in the dest array by the specified value.
    static void
    fillIntArray(int[] dest, int destPos, int count, int value)
    Fills count elements in the dest array, starting from the element #destPos, by the specified value.
    static void
    fillIntProgression(int[] dest, int start, int increment)
    Fills all elements in the dest array by the following values: start, start+increment, start+2*increment, etc.
    static void
    fillIntProgression(int[] dest, int destPos, int count, int start, int increment)
    Fills count elements in the dest array, starting from the element #destPos, by the following values: start, start+increment, start+2*increment, etc.
    static void
    fillLongArray(long[] dest, int destPos, int count, long value)
    Fills count elements in the dest array, starting from the element #destPos, by the specified value.
    static void
    fillLongArray(long[] dest, long value)
    Fills all elements in the dest array by the specified value.
    static void
    fillObjectArray(Object[] dest, int destPos, int count, Object value)
    Fills count elements in the dest array, starting from the element #destPos, by the specified value.
    static void
    fillObjectArray(Object[] dest, Object value)
    Fills all elements in the dest array by the specified value.
    static void
    fillShortArray(short[] dest, int destPos, int count, short value)
    Fills count elements in the dest array, starting from the element #destPos, by the specified value.
    static void
    fillShortArray(short[] dest, short value)
    Fills all elements in the dest array by the specified value.
    static int
    indexOfBoolean(boolean[] array, int lowIndex, int highIndex, boolean value)
    Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.
    static int
    indexOfByte(byte[] array, int lowIndex, int highIndex, byte value)
    Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.
    static int
    indexOfChar(char[] array, int lowIndex, int highIndex, char value)
    Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.
    static int
    indexOfDouble(double[] array, int lowIndex, int highIndex, double value)
    Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.
    static int
    indexOfFloat(float[] array, int lowIndex, int highIndex, float value)
    Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.
    static int
    indexOfInt(int[] array, int lowIndex, int highIndex, int value)
    Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.
    static int
    indexOfLong(long[] array, int lowIndex, int highIndex, long value)
    Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.
    static int
    indexOfObject(Object[] array, int lowIndex, int highIndex, Object value)
    Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and value==null?array[k]==null:value.equals(array[k]), or -1 if there is no such array element.
    static int
    indexOfShort(short[] array, int lowIndex, int highIndex, short value)
    Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.
    static int
    lastIndexOfBoolean(boolean[] array, int lowIndex, int highIndex, boolean value)
    Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.
    static int
    lastIndexOfByte(byte[] array, int lowIndex, int highIndex, byte value)
    Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.
    static int
    lastIndexOfChar(char[] array, int lowIndex, int highIndex, char value)
    Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.
    static int
    lastIndexOfDouble(double[] array, int lowIndex, int highIndex, double value)
    Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.
    static int
    lastIndexOfFloat(float[] array, int lowIndex, int highIndex, float value)
    Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.
    static int
    lastIndexOfInt(int[] array, int lowIndex, int highIndex, int value)
    Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.
    static int
    lastIndexOfLong(long[] array, int lowIndex, int highIndex, long value)
    Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.
    static int
    lastIndexOfObject(Object[] array, int lowIndex, int highIndex, Object value)
    Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and value==null?array[k]==null:value.equals(array[k]), or -1 if there is no such array element.
    static int
    lastIndexOfShort(short[] array, int lowIndex, int highIndex, short value)
    Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.
    static void
    maxByteArray(byte[] dest, int destPos, byte[] src, int srcPos, int count)
    Replaces count bytes in dest array, starting from the element #destPos, with the maximum of them and corresponding count bytes in src array, starting from the element #destPos.
    static void
    maxCharArray(char[] dest, int destPos, char[] src, int srcPos, int count)
    Replaces count chars in dest array, starting from the element #destPos, with the maximum of them and corresponding count chars in src array, starting from the element #destPos.
    static void
    maxDoubleArray(double[] dest, int destPos, double[] src, int srcPos, int count)
    Replaces count doubles in dest array, starting from the element #destPos, with the maximum of them and corresponding count doubles in src array, starting from the element #destPos.
    static void
    maxFloatArray(float[] dest, int destPos, float[] src, int srcPos, int count)
    Replaces count floats in dest array, starting from the element #destPos, with the maximum of them and corresponding count floats in src array, starting from the element #destPos.
    static void
    maxIntArray(int[] dest, int destPos, int[] src, int srcPos, int count)
    Replaces count ints in dest array, starting from the element #destPos, with the maximum of them and corresponding count ints in src array, starting from the element #destPos.
    static void
    maxLongArray(long[] dest, int destPos, long[] src, int srcPos, int count)
    Replaces count longs in dest array, starting from the element #destPos, with the maximum of them and corresponding count longs in src array, starting from the element #destPos.
    static void
    maxShortArray(short[] dest, int destPos, short[] src, int srcPos, int count)
    Replaces count shorts in dest array, starting from the element #destPos, with the maximum of them and corresponding count shorts in src array, starting from the element #destPos.
    static void
    minByteArray(byte[] dest, int destPos, byte[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
    static void
    minCharArray(char[] dest, int destPos, char[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
    static void
    minDoubleArray(double[] dest, int destPos, double[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
    static void
    minFloatArray(float[] dest, int destPos, float[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
    static void
    minIntArray(int[] dest, int destPos, int[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
    static void
    minLongArray(long[] dest, int destPos, long[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
    static void
    minShortArray(short[] dest, int destPos, short[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
    static void
    oppositeByteArray(byte[] dest)
    Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
    static void
    oppositeByteArray(byte[] dest, int destPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
    static void
    oppositeDoubleArray(double[] dest)
    Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
    static void
    oppositeDoubleArray(double[] dest, int destPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
    static void
    oppositeFloatArray(float[] dest)
    Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
    static void
    oppositeFloatArray(float[] dest, int destPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
    static void
    oppositeIntArray(int[] dest)
    Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
    static void
    oppositeIntArray(int[] dest, int destPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
    static void
    oppositeLongArray(long[] dest)
    Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
    static void
    oppositeLongArray(long[] dest, int destPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
    static void
    oppositeShortArray(short[] dest)
    Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
    static void
    oppositeShortArray(short[] dest, int destPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
    static void
    subtractByteArray(byte[] dest, int destPos, byte[] src, int srcPos, int count, boolean truncateOverflows)
    Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i].
    static void
    subtractCharArray(char[] dest, int destPos, char[] src, int srcPos, int count, boolean truncateOverflows)
    Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i].
    static void
    subtractDoubleArray(double[] dest, int destPos, double[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i].
    static void
    subtractFloatArray(float[] dest, int destPos, float[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i].
    static void
    subtractIntArray(int[] dest, int destPos, int[] src, int srcPos, int count, boolean truncateOverflows)
    Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i].
    static void
    subtractLongArray(long[] dest, int destPos, long[] src, int srcPos, int count)
    Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i].
    static void
    subtractShortArray(short[] dest, int destPos, short[] src, int srcPos, int count, boolean truncateOverflows)
    Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i].
    static String
    toBinaryString(boolean[] array, String separator, int maxStringLength)
    Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator.
    static String
    toHexString(byte[] array, String separator, int maxStringLength)
    Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator.
    static String
    toHexString(char[] array, String separator, int maxStringLength)
    Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator.
    static String
    toHexString(int[] array, String separator, int maxStringLength)
    Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator.
    static String
    toHexString(long[] array, String separator, int maxStringLength)
    Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator.
    static String
    toHexString(short[] array, String separator, int maxStringLength)
    Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator.
    static String
    toString(boolean[] array, String separator, int maxStringLength)
    Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator.
    static String
    toString(byte[] array, String separator, int maxStringLength)
    Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator.
    static String
    toString(byte[] array, Locale locale, String format, String separator, int maxStringLength)
    Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements.
    static String
    toString(char[] array, String separator, int maxStringLength)
    Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator.
    static String
    toString(double[] array, String separator, int maxStringLength)
    Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator.
    static String
    toString(double[] array, Locale locale, String format, String separator, int maxStringLength)
    Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements.
    static String
    toString(float[] array, String separator, int maxStringLength)
    Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator.
    static String
    toString(float[] array, Locale locale, String format, String separator, int maxStringLength)
    Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements.
    static String
    toString(int[] array, String separator, int maxStringLength)
    Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator.
    static String
    toString(int[] array, Locale locale, String format, String separator, int maxStringLength)
    Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements.
    static String
    toString(long[] array, String separator, int maxStringLength)
    Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator.
    static String
    toString(long[] array, Locale locale, String format, String separator, int maxStringLength)
    Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements.
    static String
    toString(short[] array, String separator, int maxStringLength)
    Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator.
    static String
    toString(short[] array, Locale locale, String format, String separator, int maxStringLength)
    Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements.
    static String
    toString(Object[] array, String separator, int maxStringLength)
    Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator.
    static void
    updateArrayHashCode(Object array, int fromIndex, int toIndex, Checksum hash)
    Updates hash code (hash argument) on the base of the contents of the specified fragment of the given array.
    static void
    zeroFillArray(Object dest, int destPos, int count)
    Fills count elements in the dest array, starting from the element #destPos, by zeroes (null for Object[] arrays, false for boolean[], +0.0 for floating-point types).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EMPTY_BOOLEANS

      public static final boolean[] EMPTY_BOOLEANS
      Constant, containing empty array new boolean[0].
    • EMPTY_BYTES

      public static final byte[] EMPTY_BYTES
      Constant, containing empty array new byte[0].
    • EMPTY_CHARS

      public static final char[] EMPTY_CHARS
      Constant, containing empty array new char[0].
    • EMPTY_SHORTS

      public static final short[] EMPTY_SHORTS
      Constant, containing empty array new short[0].
    • EMPTY_INTS

      public static final int[] EMPTY_INTS
      Constant, containing empty array new int[0].
    • EMPTY_LONGS

      public static final long[] EMPTY_LONGS
      Constant, containing empty array new long[0].
    • EMPTY_FLOATS

      public static final float[] EMPTY_FLOATS
      Constant, containing empty array new float[0].
    • EMPTY_DOUBLES

      public static final double[] EMPTY_DOUBLES
      Constant, containing empty array new double[0].
  • Method Details

    • copyOfRange

      public static Object copyOfRange(Object array, int fromIndex, int toIndex)
      Returns a fragment of the given array from the element #fromIndex to the element #toIndex. The type of returned array is identical to the type of array argument, the length of returned array is toIndex-fromIndex.

      The toIndex value must not be less than fromIndex, but may be greater than array.length (the length of the source array), in which case all "extra" elements of the result (with indexes #array.length..#toIndex) are zero-filled: 0 for array of numbers and characters, false for boolean array, null for array of objects.

      The method always creates a new array, even if fromIndex is 0 and toIndex is equal to array.length.

      Example of usage:

           float[] data = new float[10000];
           int len = 0;
           ... (filling some first elements, with incrementing len)
           float[] result = (float[])JArrays.copyOfRange(data, 0, len);
           // now result contains first len elements of data array

      This method is an analog of java.util.Arrays.copyOfRange methods (Java 1.6), but it works with any type of array (which is passed as Object argument) and it is compatible with JRE 1.1.

      Parameters:
      array - the source array.
      fromIndex - the initial index in array, inclusive.
      toIndex - the end index in array, exclusive. (May lie outside the array.)
      Returns:
      the specified subarray, padded by zeros to required length if toIndex > array.length. (Its length is always toIndex-fromIndex.)
      Throws:
      NullPointerException - if the array argument is null.
      IllegalArgumentException - if the array argument is not a Java array or if fromIndex is greater than toIndex.
      IndexOutOfBoundsException - if fromIndex< 0 or fromIndex > array.length.
    • copyOfRange

      public static boolean[] copyOfRange(boolean[] array, int fromIndex, int toIndex)
      Equivalent to (boolean[])copyOfRange(array, fromIndex, toIndex).
      Parameters:
      array - the source array.
      fromIndex - the initial index in array, inclusive.
      toIndex - the end index in array, exclusive. (May lie outside the array.)
      Returns:
      the specified subarray, padded by zeros to required length if toIndex > array.length. (Its length is always toIndex-fromIndex.)
      Throws:
      NullPointerException - if the array argument is null.
      IllegalArgumentException - if fromIndex is greater than toIndex.
      IndexOutOfBoundsException - if fromIndex< 0 or fromIndex > array.length.
    • copyOfRange

      public static byte[] copyOfRange(byte[] array, int fromIndex, int toIndex)
      Equivalent to (byte[])copyOfRange(array, fromIndex, toIndex).
      Parameters:
      array - the source array.
      fromIndex - the initial index in array, inclusive.
      toIndex - the end index in array, exclusive. (May lie outside the array.)
      Returns:
      the specified subarray, padded by zeros to required length if toIndex > array.length. (Its length is always toIndex-fromIndex.)
      Throws:
      NullPointerException - if the array argument is null.
      IllegalArgumentException - if fromIndex is greater than toIndex.
      IndexOutOfBoundsException - if fromIndex< 0 or fromIndex > array.length.
    • copyOfRange

      public static char[] copyOfRange(char[] array, int fromIndex, int toIndex)
      Equivalent to (char[])copyOfRange(array, fromIndex, toIndex).
      Parameters:
      array - the source array.
      fromIndex - the initial index in array, inclusive.
      toIndex - the end index in array, exclusive. (May lie outside the array.)
      Returns:
      the specified subarray, padded by zeros to required length if toIndex > array.length. (Its length is always toIndex-fromIndex.)
      Throws:
      NullPointerException - if the array argument is null.
      IllegalArgumentException - if fromIndex is greater than toIndex.
      IndexOutOfBoundsException - if fromIndex< 0 or fromIndex > array.length.
    • copyOfRange

      public static short[] copyOfRange(short[] array, int fromIndex, int toIndex)
      Equivalent to (short[])copyOfRange(array, fromIndex, toIndex).
      Parameters:
      array - the source array.
      fromIndex - the initial index in array, inclusive.
      toIndex - the end index in array, exclusive. (May lie outside the array.)
      Returns:
      the specified subarray, padded by zeros to required length if toIndex > array.length. (Its length is always toIndex-fromIndex.)
      Throws:
      NullPointerException - if the array argument is null.
      IllegalArgumentException - if fromIndex is greater than toIndex.
      IndexOutOfBoundsException - if fromIndex< 0 or fromIndex > array.length.
    • copyOfRange

      public static int[] copyOfRange(int[] array, int fromIndex, int toIndex)
      Equivalent to (int[])copyOfRange(array, fromIndex, toIndex).
      Parameters:
      array - the source array.
      fromIndex - the initial index in array, inclusive.
      toIndex - the end index in array, exclusive. (May lie outside the array.)
      Returns:
      the specified subarray, padded by zeros to required length if toIndex > array.length. (Its length is always toIndex-fromIndex.)
      Throws:
      NullPointerException - if the array argument is null.
      IllegalArgumentException - if fromIndex is greater than toIndex.
      IndexOutOfBoundsException - if fromIndex< 0 or fromIndex > array.length.
    • copyOfRange

      public static long[] copyOfRange(long[] array, int fromIndex, int toIndex)
      Equivalent to (long[])copyOfRange(array, fromIndex, toIndex).
      Parameters:
      array - the source array.
      fromIndex - the initial index in array, inclusive.
      toIndex - the end index in array, exclusive. (May lie outside the array.)
      Returns:
      the specified subarray, padded by zeros to required length if toIndex > array.length. (Its length is always toIndex-fromIndex.)
      Throws:
      NullPointerException - if the array argument is null.
      IllegalArgumentException - if fromIndex is greater than toIndex.
      IndexOutOfBoundsException - if fromIndex< 0 or fromIndex > array.length.
    • copyOfRange

      public static float[] copyOfRange(float[] array, int fromIndex, int toIndex)
      Equivalent to (float[])copyOfRange(array, fromIndex, toIndex).
      Parameters:
      array - the source array.
      fromIndex - the initial index in array, inclusive.
      toIndex - the end index in array, exclusive. (May lie outside the array.)
      Returns:
      the specified subarray, padded by zeros to required length if toIndex > array.length. (Its length is always toIndex-fromIndex.)
      Throws:
      NullPointerException - if the array argument is null.
      IllegalArgumentException - if fromIndex is greater than toIndex.
      IndexOutOfBoundsException - if fromIndex< 0 or fromIndex > array.length.
    • copyOfRange

      public static double[] copyOfRange(double[] array, int fromIndex, int toIndex)
      Equivalent to (double[])copyOfRange(array, fromIndex, toIndex).
      Parameters:
      array - the source array.
      fromIndex - the initial index in array, inclusive.
      toIndex - the end index in array, exclusive. (May lie outside the array.)
      Returns:
      the specified subarray, padded by zeros to required length if toIndex > array.length. (Its length is always toIndex-fromIndex.)
      Throws:
      NullPointerException - if the array argument is null.
      IllegalArgumentException - if fromIndex is greater than toIndex.
      IndexOutOfBoundsException - if fromIndex< 0 or fromIndex > array.length.
    • fillBooleanArray

      public static void fillBooleanArray(boolean[] dest, boolean value)
      Fills all elements in the dest array by the specified value.
      Parameters:
      dest - the filled Java array.
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
    • fillBooleanArray

      public static void fillBooleanArray(boolean[] dest, int destPos, int count, boolean value)
      Fills count elements in the dest array, starting from the element #destPos, by the specified value. Be careful: the second int argument in this method is the number of filled element, but not the end filled index as in java.util.Arrays.fill methods.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
    • fillByteArray

      public static void fillByteArray(byte[] dest, byte value)
      Fills all elements in the dest array by the specified value.
      Parameters:
      dest - the filled Java array.
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
    • fillByteArray

      public static void fillByteArray(byte[] dest, int destPos, int count, byte value)
      Fills count elements in the dest array, starting from the element #destPos, by the specified value. Be careful: the second int argument in this method is the number of filled element, but not the end filled index as in java.util.Arrays.fill methods.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
    • fillCharArray

      public static void fillCharArray(char[] dest, char value)
      Fills all elements in the dest array by the specified value.
      Parameters:
      dest - the filled Java array.
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
    • fillCharArray

      public static void fillCharArray(char[] dest, int destPos, int count, char value)
      Fills count elements in the dest array, starting from the element #destPos, by the specified value. Be careful: the second int argument in this method is the number of filled element, but not the end filled index as in java.util.Arrays.fill methods.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
    • fillShortArray

      public static void fillShortArray(short[] dest, short value)
      Fills all elements in the dest array by the specified value.
      Parameters:
      dest - the filled Java array.
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
    • fillShortArray

      public static void fillShortArray(short[] dest, int destPos, int count, short value)
      Fills count elements in the dest array, starting from the element #destPos, by the specified value. Be careful: the second int argument in this method is the number of filled element, but not the end filled index as in java.util.Arrays.fill methods.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
    • fillIntArray

      public static void fillIntArray(int[] dest, int value)
      Fills all elements in the dest array by the specified value.
      Parameters:
      dest - the filled Java array.
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
    • fillIntArray

      public static void fillIntArray(int[] dest, int destPos, int count, int value)
      Fills count elements in the dest array, starting from the element #destPos, by the specified value. Be careful: the second int argument in this method is the number of filled element, but not the end filled index as in java.util.Arrays.fill methods.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
    • fillLongArray

      public static void fillLongArray(long[] dest, long value)
      Fills all elements in the dest array by the specified value.
      Parameters:
      dest - the filled Java array.
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
    • fillLongArray

      public static void fillLongArray(long[] dest, int destPos, int count, long value)
      Fills count elements in the dest array, starting from the element #destPos, by the specified value. Be careful: the second int argument in this method is the number of filled element, but not the end filled index as in java.util.Arrays.fill methods.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
    • fillFloatArray

      public static void fillFloatArray(float[] dest, float value)
      Fills all elements in the dest array by the specified value.
      Parameters:
      dest - the filled Java array.
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
    • fillFloatArray

      public static void fillFloatArray(float[] dest, int destPos, int count, float value)
      Fills count elements in the dest array, starting from the element #destPos, by the specified value. Be careful: the second int argument in this method is the number of filled element, but not the end filled index as in java.util.Arrays.fill methods.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
    • fillDoubleArray

      public static void fillDoubleArray(double[] dest, double value)
      Fills all elements in the dest array by the specified value.
      Parameters:
      dest - the filled Java array.
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
    • fillDoubleArray

      public static void fillDoubleArray(double[] dest, int destPos, int count, double value)
      Fills count elements in the dest array, starting from the element #destPos, by the specified value. Be careful: the second int argument in this method is the number of filled element, but not the end filled index as in java.util.Arrays.fill methods.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
    • fillObjectArray

      public static void fillObjectArray(Object[] dest, Object value)
      Fills all elements in the dest array by the specified value.
      Parameters:
      dest - the filled Java array.
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
    • fillObjectArray

      public static void fillObjectArray(Object[] dest, int destPos, int count, Object value)
      Fills count elements in the dest array, starting from the element #destPos, by the specified value. Be careful: the second int argument in this method is the number of filled element, but not the end filled index as in java.util.Arrays.fill methods.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      value - the filler.
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
    • fillIntProgression

      public static void fillIntProgression(int[] dest, int destPos, int count, int start, int increment)
      Fills count elements in the dest array, starting from the element #destPos, by the following values: start, start+increment, start+2*increment, etc. Equivalent to the following loop:
           for (int i = destPos, toIndex = destPos + count; i < toIndex; i++) {
               dest[i] = start;
               start += increment;
           }
       
      but checks possible IndexOutOfBoundsException before any operations.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      start - starting value of the progression.
      increment - step of the progression.
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
    • fillIntProgression

      public static void fillIntProgression(int[] dest, int start, int increment)
      Fills all elements in the dest array by the following values: start, start+increment, start+2*increment, etc. Equivalent to the following loop:
           for (int i = 0; i < dest.length; i++) {
               dest[i] = start;
               start += increment;
           }
       
      but checks possible IndexOutOfBoundsException before any operations.
      Parameters:
      dest - the filled Java array.
      start - starting value of the progression.
      increment - step of the progression.
    • zeroFillArray

      public static void zeroFillArray(Object dest, int destPos, int count)
      Fills count elements in the dest array, starting from the element #destPos, by zeroes (null for Object[] arrays, false for boolean[], +0.0 for floating-point types). Be careful: the second int argument in this method is the number of filled element, but not the end filled index as in java.util.Arrays.fill methods.
      Parameters:
      dest - the filled Java array.
      destPos - starting index of element to replace.
      count - the number of elements to be filled (should be >=0).
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if the dest argument is not a Java array, or if count is negative.
      IndexOutOfBoundsException - if filling would cause access of data outside the array.
      See Also:
    • areElementsZero

      public static boolean areElementsZero(Object array, int pos, int count)
      Returns true if the specified fragment of the passed Java array is filled by zero (false for boolean[] array, (char)0 for char[], null for non-primitive element type). Returns false if at least one of elements array[pos]..array[pos+count-1] is non-zero.

      For arrays of floating-point types, unlike arrayEquals(Object, int, Object, int, int), this method considers that +0.0==-0.0: both values are considered to be zero.

      If the count argument (number of elements) is 0, this method returns true.

      Parameters:
      array - the checked Java array.
      pos - the initial index of the checked fragment in the array.
      count - the number of checked elements.
      Returns:
      true if and only if all elements array[pos]..array[pos+count-1] are zero or if count==0.
      Throws:
      NullPointerException - if the array argument is null.
      IllegalArgumentException - if the dest argument is not a Java array, or if count is negative.
      IndexOutOfBoundsException - if pos is negative, or if pos+count is greater than array.length.
      See Also:
    • arrayHashCode

      public static int arrayHashCode(Object array, int fromIndex, int toIndex)
      Returns a hash code based on the contents of the specified fragment of the given array. If the passed array is null or fromIndex==toIndex, returns 0.

      If the array is Object[], the result is based on standard hashCode method for all elements of the array. In particular, in this case, if the array contains other arrays as elements, the hash code is based on their identities rather than their contents.

      The returned hash code depends only on the sequence of elements, but does not depend on the position of this sequence in the passed Java array.

      For any two arrays a1 and a2 such that JArrays.arrayEquals(a1, pos1, a2, pos2, count), it is also the case that JArrays.arrayHashCode(a1, pos1, pos1 + count) == JArrays.arrayHashCode(a2, pos2, pos2 + count).

      This method is an extended analog of java.util.Arrays.hashCode methods, compatible with JRE 1.1 and using more safe algorithm, based on CRC32.

      Parameters:
      array - the array whose content-based hash code to compute.
      fromIndex - the initial index of the checked fragment, inclusive.
      toIndex - the end index of the checked fragment, exclusive.
      Returns:
      a content-based hash code for the specified fragment in array.
      Throws:
      IllegalArgumentException - if the array argument is not a Java array.
      IndexOutOfBoundsException - if fromIndex or toIndex are negative, or if toIndex is greater than array.length (0 when array==null), or if fromIndex is greater than startIndex, or if array==null and not fromIndex==toIndex==0.
      See Also:
    • updateArrayHashCode

      public static void updateArrayHashCode(Object array, int fromIndex, int toIndex, Checksum hash)
      Updates hash code (hash argument) on the base of the contents of the specified fragment of the given array. If the passed array is null or fromIndex==toIndex, does nothing.

      This method is used by arrayHashCode(Object array, int fromIndex, int toIndex). More precisely, that method is equivalent to:

       Checksum sum = new CRC32();
       updateArrayHashCode(array, fromIndex, toIndex, sum);
       return fromIndex == toIndex ? 0 : (int)sum.getValue();
       

      The following 2 code fragment always produce the same results in hashargument:

       updateArrayHashCode(arr, fromIndex, toIndex, hash);
       
      and
       updateArrayHashCode(arr, fromIndex, k1, hash);
       updateArrayHashCode(arr, k1, k2, hash);
       ...
       updateArrayHashCode(arr, kN, toIndex, hash);
       
      where fromIndex <= k1 <= k2 <= ... <= kN <= toIndex. So, unlike arrayHashCode, this method allows to calculate correct hash code of a long array when we cannot get all its element at the same time, but can get sequent portions ot it.
      Parameters:
      array - the array whose content-based hash code to compute.
      fromIndex - the initial index of the checked fragment, inclusive.
      toIndex - the end index of the checked fragment, exclusive.
      hash - updated hash code.
      Throws:
      NullPointerException - if the hash argument is null.
      IllegalArgumentException - if the array argument is not a Java array.
      IndexOutOfBoundsException - if fromIndex or toIndex are negative, or if toIndex is greater than array.length (0 when array==null), or if fromIndex is greater than startIndex, or if array==null and not fromIndex==toIndex==0.
    • arrayEquals

      public static boolean arrayEquals(Object array1, int pos1, Object array2, int pos2, int length)
      Returns true if the arguments are Java arrays and their specified fragments are equals, or if both arguments are null. Returns false if one of the arguments is null, but the other is not null.

      The two fragments of the passed arrays are considered equal if all corresponding pairs of elements are equal. For arrays of primitive types (byte[], short, etc.), the fragments are considered equal only if the types of their elements are identical. For arrays of floating-point types, unlike the == operator, this method considers NaN equals to itself, and 0.0 unequal to -0.0. For Object[] arrays, two objects e1 and e2 are considered equal if (e1==null ? e2==null : e1.equals(e2)).

      This method is an extended analog of java.util.Arrays.equals methods, compatible with JRE 1.1.

      Parameters:
      array1 - one array to be tested for equality.
      pos1 - the initial index of the checked fragment in the first array.
      array2 - the other array to be tested for equality.
      pos2 - the initial index of the checked fragment in the second array.
      length - the number of compared elements.
      Returns:
      true if the specified fragments of two arrays are equal.
      Throws:
      IllegalArgumentException - if the array1 or array2 argument is not a Java array or if length is negative.
      IndexOutOfBoundsException - if pos1, pos2 or length are negative, or if pos1+length is greater than array1.length (0 when array1==null), or if pos2+length is greater than array2.length (0 when array2==null).
    • indexOfBoolean

      public static int indexOfBoolean(boolean[] array, int lowIndex, int highIndex, boolean value)
      Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.

      In particular, if lowIndex>=array.length or lowIndex>=highIndex, this method returns -1, and if lowIndex<0, the result is the same as if lowIndex==0.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index for search (inclusive).
      highIndex - the high index for search (exclusive); pass array.length to search all remaining elements.
      value - the value to be found.
      Returns:
      the index of the first occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • lastIndexOfBoolean

      public static int lastIndexOfBoolean(boolean[] array, int lowIndex, int highIndex, boolean value)
      Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.

      In particular, if highIndex<=0 or highIndex<=lowIndex, this method returns -1, and if highIndex>=array.length, the result is the same as if highIndex==array.length.

      Note that lowIndex and highIndex arguments have the same sense as in indexOfBoolean(boolean[], int, int, boolean) method: they describes the search index range lowIndex<=k<highIndex.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index in the array for search (inclusive); pass 0 to search all remaining elements.
      highIndex - the high index in the array for search (exclusive).
      value - the value to be found.
      Returns:
      the index of the last occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • indexOfByte

      public static int indexOfByte(byte[] array, int lowIndex, int highIndex, byte value)
      Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.

      In particular, if lowIndex>=array.length or lowIndex>=highIndex, this method returns -1, and if lowIndex<0, the result is the same as if lowIndex==0.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index for search (inclusive).
      highIndex - the high index for search (exclusive); pass array.length to search all remaining elements.
      value - the value to be found.
      Returns:
      the index of the first occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • lastIndexOfByte

      public static int lastIndexOfByte(byte[] array, int lowIndex, int highIndex, byte value)
      Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.

      In particular, if highIndex<=0 or highIndex<=lowIndex, this method returns -1, and if highIndex>=array.length, the result is the same as if highIndex==array.length.

      Note that lowIndex and highIndex arguments have the same sense as in indexOfByte(byte[], int, int, byte) method: they describes the search index range lowIndex<=k<highIndex.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index in the array for search (inclusive); pass 0 to search all remaining elements.
      highIndex - the high index in the array for search (exclusive).
      value - the value to be found.
      Returns:
      the index of the last occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • indexOfChar

      public static int indexOfChar(char[] array, int lowIndex, int highIndex, char value)
      Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.

      In particular, if lowIndex>=array.length or lowIndex>=highIndex, this method returns -1, and if lowIndex<0, the result is the same as if lowIndex==0.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index for search (inclusive).
      highIndex - the high index for search (exclusive); pass array.length to search all remaining elements.
      value - the value to be found.
      Returns:
      the index of the first occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • lastIndexOfChar

      public static int lastIndexOfChar(char[] array, int lowIndex, int highIndex, char value)
      Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.

      In particular, if highIndex<=0 or highIndex<=lowIndex, this method returns -1, and if highIndex>=array.length, the result is the same as if highIndex==array.length.

      Note that lowIndex and highIndex arguments have the same sense as in indexOfChar(char[], int, int, char) method: they describes the search index range lowIndex<=k<highIndex.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index in the array for search (inclusive); pass 0 to search all remaining elements.
      highIndex - the high index in the array for search (exclusive).
      value - the value to be found.
      Returns:
      the index of the last occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • indexOfShort

      public static int indexOfShort(short[] array, int lowIndex, int highIndex, short value)
      Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.

      In particular, if lowIndex>=array.length or lowIndex>=highIndex, this method returns -1, and if lowIndex<0, the result is the same as if lowIndex==0.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index for search (inclusive).
      highIndex - the high index for search (exclusive); pass array.length to search all remaining elements.
      value - the value to be found.
      Returns:
      the index of the first occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • lastIndexOfShort

      public static int lastIndexOfShort(short[] array, int lowIndex, int highIndex, short value)
      Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.

      In particular, if highIndex<=0 or highIndex<=lowIndex, this method returns -1, and if highIndex>=array.length, the result is the same as if highIndex==array.length.

      Note that lowIndex and highIndex arguments have the same sense as in indexOfShort(short[], int, int, short) method: they describes the search index range lowIndex<=k<highIndex.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index in the array for search (inclusive); pass 0 to search all remaining elements.
      highIndex - the high index in the array for search (exclusive).
      value - the value to be found.
      Returns:
      the index of the last occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • indexOfInt

      public static int indexOfInt(int[] array, int lowIndex, int highIndex, int value)
      Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.

      In particular, if lowIndex>=array.length or lowIndex>=highIndex, this method returns -1, and if lowIndex<0, the result is the same as if lowIndex==0.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index for search (inclusive).
      highIndex - the high index for search (exclusive); pass array.length to search all remaining elements.
      value - the value to be found.
      Returns:
      the index of the first occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • lastIndexOfInt

      public static int lastIndexOfInt(int[] array, int lowIndex, int highIndex, int value)
      Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.

      In particular, if highIndex<=0 or highIndex<=lowIndex, this method returns -1, and if highIndex>=array.length, the result is the same as if highIndex==array.length.

      Note that lowIndex and highIndex arguments have the same sense as in indexOfInt(int[], int, int, int) method: they describes the search index range lowIndex<=k<highIndex.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index in the array for search (inclusive); pass 0 to search all remaining elements.
      highIndex - the high index in the array for search (exclusive).
      value - the value to be found.
      Returns:
      the index of the last occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • indexOfLong

      public static int indexOfLong(long[] array, int lowIndex, int highIndex, long value)
      Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.

      In particular, if lowIndex>=array.length or lowIndex>=highIndex, this method returns -1, and if lowIndex<0, the result is the same as if lowIndex==0.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index for search (inclusive).
      highIndex - the high index for search (exclusive); pass array.length to search all remaining elements.
      value - the value to be found.
      Returns:
      the index of the first occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • lastIndexOfLong

      public static int lastIndexOfLong(long[] array, int lowIndex, int highIndex, long value)
      Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.

      In particular, if highIndex<=0 or highIndex<=lowIndex, this method returns -1, and if highIndex>=array.length, the result is the same as if highIndex==array.length.

      Note that lowIndex and highIndex arguments have the same sense as in indexOfLong(long[], int, int, long) method: they describes the search index range lowIndex<=k<highIndex.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index in the array for search (inclusive); pass 0 to search all remaining elements.
      highIndex - the high index in the array for search (exclusive).
      value - the value to be found.
      Returns:
      the index of the last occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • indexOfFloat

      public static int indexOfFloat(float[] array, int lowIndex, int highIndex, float value)
      Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.

      In particular, if lowIndex>=array.length or lowIndex>=highIndex, this method returns -1, and if lowIndex<0, the result is the same as if lowIndex==0.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index for search (inclusive).
      highIndex - the high index for search (exclusive); pass array.length to search all remaining elements.
      value - the value to be found.
      Returns:
      the index of the first occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • lastIndexOfFloat

      public static int lastIndexOfFloat(float[] array, int lowIndex, int highIndex, float value)
      Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.

      In particular, if highIndex<=0 or highIndex<=lowIndex, this method returns -1, and if highIndex>=array.length, the result is the same as if highIndex==array.length.

      Note that lowIndex and highIndex arguments have the same sense as in indexOfFloat(float[], int, int, float) method: they describes the search index range lowIndex<=k<highIndex.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index in the array for search (inclusive); pass 0 to search all remaining elements.
      highIndex - the high index in the array for search (exclusive).
      value - the value to be found.
      Returns:
      the index of the last occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • indexOfDouble

      public static int indexOfDouble(double[] array, int lowIndex, int highIndex, double value)
      Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and array[k]==value, or -1 if there is no such array element.

      In particular, if lowIndex>=array.length or lowIndex>=highIndex, this method returns -1, and if lowIndex<0, the result is the same as if lowIndex==0.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index for search (inclusive).
      highIndex - the high index for search (exclusive); pass array.length to search all remaining elements.
      value - the value to be found.
      Returns:
      the index of the first occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • lastIndexOfDouble

      public static int lastIndexOfDouble(double[] array, int lowIndex, int highIndex, double value)
      Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and array[k]==value, or -1 if there is no such array element.

      In particular, if highIndex<=0 or highIndex<=lowIndex, this method returns -1, and if highIndex>=array.length, the result is the same as if highIndex==array.length.

      Note that lowIndex and highIndex arguments have the same sense as in indexOfDouble(double[], int, int, double) method: they describes the search index range lowIndex<=k<highIndex.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index in the array for search (inclusive); pass 0 to search all remaining elements.
      highIndex - the high index in the array for search (exclusive).
      value - the value to be found.
      Returns:
      the index of the last occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • indexOfObject

      public static int indexOfObject(Object[] array, int lowIndex, int highIndex, Object value)
      Returns the minimal index k, so that lowIndex<=k<min(highIndex,array.length) and value==null?array[k]==null:value.equals(array[k]), or -1 if there is no such array element.

      In particular, if lowIndex>=array.length or lowIndex>=highIndex, this method returns -1, and if lowIndex<0, the result is the same as if lowIndex==0.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index for search (inclusive).
      highIndex - the high index for search (exclusive); pass array.length to search all remaining elements.
      value - the value to be found.
      Returns:
      the index of the first occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • lastIndexOfObject

      public static int lastIndexOfObject(Object[] array, int lowIndex, int highIndex, Object value)
      Returns the maximal index k, so that highIndex>k>=max(lowIndex,0) and value==null?array[k]==null:value.equals(array[k]), or -1 if there is no such array element.

      In particular, if highIndex<=0 or highIndex<=lowIndex, this method returns -1, and if highIndex>=array.length, the result is the same as if highIndex==array.length.

      Note that lowIndex and highIndex arguments have the same sense as in indexOfObject(Object[], int, int, Object) method: they describes the search index range lowIndex<=k<highIndex.

      Parameters:
      array - the searched Java array.
      lowIndex - the low index in the array for search (inclusive); pass 0 to search all remaining elements.
      highIndex - the high index in the array for search (exclusive).
      value - the value to be found.
      Returns:
      the index of the last occurrence of this value in range lowIndex..highIndex-1, or -1 if this value does not occur or if max(lowIndex,0)>=min(highIndex,array.length).
      Throws:
      NullPointerException - if array is null.
      See Also:
    • minByteArray

      public static void minByteArray(byte[] dest, int destPos, byte[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos. The byte elements are considered to be unsigned: min(a,b)=(a&0xFF)<(b&0xFF)?a:b.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • maxByteArray

      public static void maxByteArray(byte[] dest, int destPos, byte[] src, int srcPos, int count)
      Replaces count bytes in dest array, starting from the element #destPos, with the maximum of them and corresponding count bytes in src array, starting from the element #destPos. The byte elements are considered to be unsigned: max(a,b)=(a&0xFF)>(b&0xFF)?a:b.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • minShortArray

      public static void minShortArray(short[] dest, int destPos, short[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos. The short elements are considered to be unsigned: min(a,b)=(a&0xFFFF)<(b&0xFFFF)?a:b.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • maxShortArray

      public static void maxShortArray(short[] dest, int destPos, short[] src, int srcPos, int count)
      Replaces count shorts in dest array, starting from the element #destPos, with the maximum of them and corresponding count shorts in src array, starting from the element #destPos. The short elements are considered to be unsigned: max(a,b)=(a&0xFFFF)>(b&0xFFFF)?a:b.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • minCharArray

      public static void minCharArray(char[] dest, int destPos, char[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • maxCharArray

      public static void maxCharArray(char[] dest, int destPos, char[] src, int srcPos, int count)
      Replaces count chars in dest array, starting from the element #destPos, with the maximum of them and corresponding count chars in src array, starting from the element #destPos.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • minIntArray

      public static void minIntArray(int[] dest, int destPos, int[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • maxIntArray

      public static void maxIntArray(int[] dest, int destPos, int[] src, int srcPos, int count)
      Replaces count ints in dest array, starting from the element #destPos, with the maximum of them and corresponding count ints in src array, starting from the element #destPos.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • minLongArray

      public static void minLongArray(long[] dest, int destPos, long[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • maxLongArray

      public static void maxLongArray(long[] dest, int destPos, long[] src, int srcPos, int count)
      Replaces count longs in dest array, starting from the element #destPos, with the maximum of them and corresponding count longs in src array, starting from the element #destPos.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • minFloatArray

      public static void minFloatArray(float[] dest, int destPos, float[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • maxFloatArray

      public static void maxFloatArray(float[] dest, int destPos, float[] src, int srcPos, int count)
      Replaces count floats in dest array, starting from the element #destPos, with the maximum of them and corresponding count floats in src array, starting from the element #destPos.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • minDoubleArray

      public static void minDoubleArray(double[] dest, int destPos, double[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the minimum of them and corresponding count elements in src array, starting from the element #destPos.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • maxDoubleArray

      public static void maxDoubleArray(double[] dest, int destPos, double[] src, int srcPos, int count)
      Replaces count doubles in dest array, starting from the element #destPos, with the maximum of them and corresponding count doubles in src array, starting from the element #destPos.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addByteArray

      public static void addByteArray(int[] dest, int destPos, byte[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]&0xFF). The byte elements are considered to be unsigned.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addByteArray

      public static void addByteArray(double[] dest, int destPos, byte[] src, int srcPos, int count, double mult)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]&0xFF)*mult. The byte elements are considered to be unsigned.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      mult - the elements from src array are multiplied by this value before adding.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addCharArray

      public static void addCharArray(int[] dest, int destPos, char[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]).
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addCharArray

      public static void addCharArray(double[] dest, int destPos, char[] src, int srcPos, int count, double mult)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i])*mult.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      mult - the elements from src array are multiplied by this value before adding.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addShortArray

      public static void addShortArray(int[] dest, int destPos, short[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]&0xFFFF). The short elements are considered to be unsigned.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addShortArray

      public static void addShortArray(double[] dest, int destPos, short[] src, int srcPos, int count, double mult)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]&0xFFFF)*mult. The short elements are considered to be unsigned.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      mult - the elements from src array are multiplied by this value before adding.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addIntArray

      public static void addIntArray(int[] dest, int destPos, int[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]).
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addIntArray

      public static void addIntArray(double[] dest, int destPos, int[] src, int srcPos, int count, double mult)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i])*mult.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      mult - the elements from src array are multiplied by this value before adding.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addLongArray

      public static void addLongArray(int[] dest, int destPos, long[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]).
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addLongArray

      public static void addLongArray(double[] dest, int destPos, long[] src, int srcPos, int count, double mult)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i])*mult.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      mult - the elements from src array are multiplied by this value before adding.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addFloatArray

      public static void addFloatArray(int[] dest, int destPos, float[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]).
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addFloatArray

      public static void addFloatArray(double[] dest, int destPos, float[] src, int srcPos, int count, double mult)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i])*mult.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      mult - the elements from src array are multiplied by this value before adding.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addDoubleArray

      public static void addDoubleArray(int[] dest, int destPos, double[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i]).
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • addDoubleArray

      public static void addDoubleArray(double[] dest, int destPos, double[] src, int srcPos, int count, double mult)
      Replaces count elements in dest array, starting from the element #destPos, with the sum of them and corresponding count elements in src array, multiplied by mult argument, starting from the element #srcPos: dest[destPos+i]+=(src[srcPos+i])*mult.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      mult - the elements from src array are multiplied by this value before adding.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • subtractByteArray

      public static void subtractByteArray(byte[] dest, int destPos, byte[] src, int srcPos, int count, boolean truncateOverflows)
      Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i]. If truncateOverflows argument is true, the difference is truncated to 0..0xFF range before assigning to dest elements. The byte elements are considered to be unsigned.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      truncateOverflows - whether the results should be truncated to 0..0xFF range.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • subtractCharArray

      public static void subtractCharArray(char[] dest, int destPos, char[] src, int srcPos, int count, boolean truncateOverflows)
      Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i]. If truncateOverflows argument is true, the difference is truncated to 0..0xFFFF range before assigning to dest elements.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      truncateOverflows - whether the results should be truncated to 0..0xFFFF range.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • subtractShortArray

      public static void subtractShortArray(short[] dest, int destPos, short[] src, int srcPos, int count, boolean truncateOverflows)
      Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i]. If truncateOverflows argument is true, the difference is truncated to 0..0xFFFF range before assigning to dest elements. The short elements are considered to be unsigned.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      truncateOverflows - whether the results should be truncated to 0..0xFFFF range.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • subtractIntArray

      public static void subtractIntArray(int[] dest, int destPos, int[] src, int srcPos, int count, boolean truncateOverflows)
      Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i]. If truncateOverflows argument is true, the difference is truncated to Integer.MIN_VALUE..Integer.MAX_VALUE range before assigning to dest elements.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      truncateOverflows - whether the results should be truncated to Integer.MIN_VALUE..Integer.MAX_VALUE range.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • subtractLongArray

      public static void subtractLongArray(long[] dest, int destPos, long[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i].
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • subtractFloatArray

      public static void subtractFloatArray(float[] dest, int destPos, float[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i].
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • subtractDoubleArray

      public static void subtractDoubleArray(double[] dest, int destPos, double[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=dest[destPos+i]-src[srcPos+i].
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • absDiffOfByteArray

      public static void absDiffOfByteArray(byte[] dest, int destPos, byte[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|. (The byte elements are considered to be unsigned.)
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • absDiffOfCharArray

      public static void absDiffOfCharArray(char[] dest, int destPos, char[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • absDiffOfShortArray

      public static void absDiffOfShortArray(short[] dest, int destPos, short[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|. (The short elements are considered to be unsigned.)
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • absDiffOfLongArray

      public static void absDiffOfLongArray(long[] dest, int destPos, long[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • absDiffOfFloatArray

      public static void absDiffOfFloatArray(float[] dest, int destPos, float[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • absDiffOfDoubleArray

      public static void absDiffOfDoubleArray(double[] dest, int destPos, double[] src, int srcPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • absDiffOfIntArray

      public static void absDiffOfIntArray(int[] dest, int destPos, int[] src, int srcPos, int count, boolean truncateOverflows)
      Replaces count elements in dest array, starting from the element #destPos, with the absolute value of the difference of them and corresponding count elements in src array, starting from the element #srcPos: dest[destPos+i]=|dest[destPos+i]-src[srcPos+i]|. If truncateOverflows argument is true, the difference is truncated to 0..Integer.MAX_VALUE range before assigning to dest elements.
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      src - the source array.
      srcPos - position of the first read element in the source array.
      count - the number of elements to be replaced (should be >=0).
      truncateOverflows - whether the results should be truncated to Integer.MIN_VALUE..Integer.MAX_VALUE range.
      Throws:
      NullPointerException - if either src or dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • oppositeByteArray

      public static void oppositeByteArray(byte[] dest)
      Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
      Parameters:
      dest - the destination array.
      Throws:
      NullPointerException - if dest is null.
    • oppositeByteArray

      public static void oppositeByteArray(byte[] dest, int destPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • oppositeShortArray

      public static void oppositeShortArray(short[] dest)
      Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
      Parameters:
      dest - the destination array.
      Throws:
      NullPointerException - if dest is null.
    • oppositeShortArray

      public static void oppositeShortArray(short[] dest, int destPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • oppositeIntArray

      public static void oppositeIntArray(int[] dest)
      Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
      Parameters:
      dest - the destination array.
      Throws:
      NullPointerException - if dest is null.
    • oppositeIntArray

      public static void oppositeIntArray(int[] dest, int destPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • oppositeLongArray

      public static void oppositeLongArray(long[] dest)
      Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
      Parameters:
      dest - the destination array.
      Throws:
      NullPointerException - if dest is null.
    • oppositeLongArray

      public static void oppositeLongArray(long[] dest, int destPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • oppositeFloatArray

      public static void oppositeFloatArray(float[] dest)
      Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
      Parameters:
      dest - the destination array.
      Throws:
      NullPointerException - if dest is null.
    • oppositeFloatArray

      public static void oppositeFloatArray(float[] dest, int destPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • oppositeDoubleArray

      public static void oppositeDoubleArray(double[] dest)
      Replaces all elements in dest array with the same values with the minus sign: dest[i]=-dest[i].
      Parameters:
      dest - the destination array.
      Throws:
      NullPointerException - if dest is null.
    • oppositeDoubleArray

      public static void oppositeDoubleArray(double[] dest, int destPos, int count)
      Replaces count elements in dest array, starting from the element #destPos, with the same values with the minus sign: dest[destPos+i]=-dest[destPos+i].
      Parameters:
      dest - the destination array.
      destPos - position of the first replaced element in the destination array.
      count - the number of elements to be replaced (should be >=0).
      Throws:
      NullPointerException - if dest is null.
      IllegalArgumentException - if count is negative.
      IndexOutOfBoundsException - if accessing elements would cause access of data outside array bounds.
    • toString

      public static String toString(boolean[] array, String separator, int maxStringLength)
      Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source Java array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(char[] array, String separator, int maxStringLength)
      Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source Java array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(byte[] array, String separator, int maxStringLength)
      Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source Java array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(short[] array, String separator, int maxStringLength)
      Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source Java array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(int[] array, String separator, int maxStringLength)
      Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source Java array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(long[] array, String separator, int maxStringLength)
      Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source Java array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(float[] array, String separator, int maxStringLength)
      Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source Java array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(double[] array, String separator, int maxStringLength)
      Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source Java array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(Object[] array, String separator, int maxStringLength)
      Joins and returns as a string the standard string representations for all elements of the Java array, separating elements by the given separator. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source Java array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(byte[] array, Locale locale, String format, String separator, int maxStringLength)
      Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      locale - the locale that will be passed to String.format(locale,format,v) call.
      format - format string for numeric elements: each element v is converted to string by String.format(locale,format,v) call.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(short[] array, Locale locale, String format, String separator, int maxStringLength)
      Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      locale - the locale that will be passed to String.format(locale,format,v) call.
      format - format string for numeric elements: each element v is converted to string by String.format(locale,format,v) call.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(int[] array, Locale locale, String format, String separator, int maxStringLength)
      Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      locale - the locale that will be passed to String.format(locale,format,v) call.
      format - format string for numeric elements: each element v is converted to string by String.format(locale,format,v) call.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(long[] array, Locale locale, String format, String separator, int maxStringLength)
      Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      locale - the locale that will be passed to String.format(locale,format,v) call.
      format - format string for numeric elements: each element v is converted to string by String.format(locale,format,v) call.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(float[] array, Locale locale, String format, String separator, int maxStringLength)
      Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      locale - the locale that will be passed to String.format(locale,format,v) call.
      format - format string for numeric elements: each element v is converted to string by String.format(locale,format,v) call.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toString

      public static String toString(double[] array, Locale locale, String format, String separator, int maxStringLength)
      Joins and returns as a string the string representations for all elements of the Java array, separating elements by the given separator, using format string for formatting numeric elements. Equivalent to Arrays.toString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      locale - the locale that will be passed to String.format(locale,format,v) call.
      format - format string for numeric elements: each element v is converted to string by String.format(locale,format,v) call.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toBinaryString

      public static String toBinaryString(boolean[] array, String separator, int maxStringLength)
      Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator. Equivalent to Arrays.toHexString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toHexString

      public static String toHexString(char[] array, String separator, int maxStringLength)
      Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator. Equivalent to Arrays.toHexString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toHexString

      public static String toHexString(byte[] array, String separator, int maxStringLength)
      Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator. Equivalent to Arrays.toHexString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toHexString

      public static String toHexString(short[] array, String separator, int maxStringLength)
      Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator. Equivalent to Arrays.toHexString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toHexString

      public static String toHexString(int[] array, String separator, int maxStringLength)
      Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator. Equivalent to Arrays.toHexString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.
    • toHexString

      public static String toHexString(long[] array, String separator, int maxStringLength)
      Joins and returns as a string the "hexadecimal" string representations for all elements of the AlgART array, separating elements by the given separator. Equivalent to Arrays.toHexString(SimpleMemoryModel.getInstance().valueOf(array), separator, maxStringLength), but works little faster.
      Parameters:
      array - the source AlgART array.
      separator - the string used for separating elements.
      maxStringLength - the maximal allowed length of returned string (longer results are truncated with adding "..." at the end).
      Returns:
      the string representations of all elements joined into one string.
      Throws:
      NullPointerException - if array or separator argument is null.
      IllegalArgumentException - if maxStringLength <= 0.