Java Array Methods

The Array Class provides various Java Array Methods or Functions for manipulating arrays. The Java Method performs Searching array items, sorting them, etc. This Array Class also contains a static factory that allows arrays to be viewed as Lists.

Let us see the available list of Java Array Methods and their corresponding description. You can use the hyperlinks to get detailed information about each Java Array Method, along with the practical example.

Java Array Methods

The following table will show you the list of available Array Functions or methods in the Java Array Class

Modifier TypeJava Array MethodsDescription
static intbinarySearch(byte[] x, byte key)Using a binary search algorithm, it searches the byte array x for user-specified byte value(key).
static intbinarySearch(byte[] x, int fromIndex, int toIndex, byte key)Using a binary search algorithm, this will search the range of a byte array x for user-specified byte value(key).
static intbinarySearch(char[] x, char key)It assigns the user-specified Double value (val) to each and every element present in between the specified range of the array x
static intbinarySearch(char[] x, int fromIndex, int toIndex, char key)It searches the range of a character array x for the user-specified character(key) using a binary search algorithm.
static intbinarySearch(short[] x, short key)This Java Array method searches the short array x for user-specified short value(key) using a binary search algorithm.
static intbinarySearch(short[] x, int fromIndex, int toIndex, short key)It searches the range of a short Array x for a user-specified short value(key) using a binary search algorithm.
static intbinarySearch(double[] x, double key)It searches the double array x for the user-specified double value(key) using a binary search algorithm.
static intbinarySearch(double[] x, int fromIndex, int toIndex, double key)It assigns the Floating point value (val) to each element present in between the specified range of the array x
static intbinarySearch(float[] x, float key)It searches the Float array x for the user-specified floating point value(key) using a binary search algorithm.
static intbinarySearch(float[] x, int fromIndex, int toIndex, float key)This Java Method assigns the user-specified Integer value (val) to each and every element present in between a specified range of the array x
static intbinarySearch(int[] x, int key)It assigns the user-specified Long value (val) to each element present between the specified range of the array x
static intbinarySearch(int[] x, int fromIndex, int toIndex, int key)Using a binary search algorithm, this Java Array method searches the Integer array x for the user-specified Integer(key).
static intbinarySearch(long[] x, long key)It searches the Long array x for user-specified long value(key) using a binary search algorithm.
static intbinarySearch(long[] x, int fromIndex, int toIndex, long key)Using a binary search algorithm, it searches the Long array x for user-specified long value(key).
static intbinarySearch(Object[] x, Object key)Using a binary search algorithm, it searches the Object array x for a user-specified Object(key).
static intbinarySearch(Object[] x, int fromIndex, int toIndex, Object key)This Java method or function assigns the user specified Object(val) to each and every element present in between the specified range of the array x
static boolean[]copyOf(boolean[] x, int newLength)It copies the Boolean Array x into New of user specified length.
static byte[]copyOf(byte[] x, int newLength)It copies the byte Array x into New of a given length.
static char[]copyOf(char[] x, int newLength)It copies the char Array x into New of user specified length.
static short[]copyOf(short[] x, int newLength)This Java Array Method copies the short Array x into New of user-specified length.
static double[]copyOf(double[] x, int newLength)Copyof Method copies the double Array x into a New double of user-specified length.
static float[]copyOf(float[] x, int newLength)It copies the float Array x into New of user specified length.
static int[]copyOf(int[] x, int newLength)It copies the integer Array x into New of a specified length.
static long[]copyOf(long[] x, int newLength)Copy the Long Array x into New Long.
static <T> T[]copyOf(T[] x, int newLength)It copies the Object Array x into the New one of user specified length.
static <T, U> T[]copyOf(U[] x, int newLength, Class<? extends T[]> newType)This Java Method copies the specified range of Object Array x into New of user specified length and type.
static boolean[]copyOfRange(boolean[] x, int from, int to)It copies the specified range of Boolean Array x into a New.
static byte[]copyOfRange(byte[] x, int from, int to)It copies the specified range of Byte Array x into a New.
static char[]copyOfRange(char[] x, int from, int to)It copies the Char Array x into a New.
static short[]copyOfRange(short[] x,int from, int to)This Java Method returns a boolean TRUE If Byte arrays x and y are equal to one another.
static double[]copyOfRange(double[] x, int from, int to)It copies the specified range of Double Array x into a New.
static float[]copyOfRange(float[] x, int from, int to)It copies the float Array x into a New float array of user-specified length.
static int[]copyOfRange(int[] x, int from, int to)It copies the specified range of integer Array x into a New.
static long[]copyOfRange(long[] x,int from, int to)It copies the specified range of Long Array x into a New.
static <T> T[]copyOfRange(T[] x,int from, int to)This Java Array Method copies the specified range of Object Array x into a New.
static <T, U> T[]copyOfRange(U[] x, int from, int to, Class<? copyOfRange T[]> newType)It copies the specified range of Object Array x into a New one of the specified type.
static booleanequals(boolean[] x, boolean[] y)It returns a boolean TRUE If Boolean arrays x and y are equal to one another.
static booleanequals(byte[] x, byte[] y)It returns a boolean TRUE If Double arrays x and y are equal to one another.
static booleanequals(char[] x, char[] y)It returns a boolean TRUE If Characters arrays x and y are equal to one another.
static booleanequals(short[] x, short[] y)It returns a boolean TRUE If Short arrays x and y are equal.
static booleanequals(double[] x, double[] y)If x and y arrays of Integers are equal to one another, it returns a boolean TRUE
static booleanequals(float[] x, float[] y)It returns a boolean TRUE If Float arrays x and y are equal to one another.
static booleanequals(int[] x, int[] y)This Java Array Method returns a boolean TRUE If Long arrays x and y are equal to one another.
static booleanequals(long[] x, long[] y)This Java Array Method returns boolean TRUE If Long arrays x and y are equal to one another.
static booleanequals(Object[] x, Object[] y)It returns a boolean TRUE If Object arrays x and y are equal to one another.
static voidfill(boolean[] x, boolean val)It assigns the user specified boolean value (val) to each and every element of the array x
static voidfill(boolean[] x, int fromIndex, int toIndex, boolean val)This Java Array Method assigns the user specified boolean value (val) to each and every element present in between the specified range of the array x
static voidfill(byte[] x, byte val)It assigns the user specified byte(val) to each and every element of the array x
static voidfill(byte[] x, int fromIndex, int toIndex, byte val)It assigns the user specified byte value(val) to each and every element present in between the specified range of the array x
static voidfill(char[] x, char val)This Java Array Method assigns the user specified Character (val) to each and every element of the array x
static voidfill(char[] x, int fromIndex, int toIndex, char val)It assigns the user specified Character (val) to each and every element present in between the specified range of the array x
static voidfill(short[] x, short val)It assigns the user specified short value (val) to every element of the array x
static voidfill(short[] x, int fromIndex, int toIndex, short val)It assigns the user specified short value (val) to each element present in between the specified range of the array x
static voidfill(double[] x, double val)It assigns the Double value (val) to each element of the array x
static voidfill(double[] x, int fromIndex, int toIndex, double val)It assigns a Double value (val) between the specified range of the array x
static voidfill(float[] x, float val)It assigns a Floating point value (val) to every element of the array x
static voidfill(float[] x, int fromIndex, int toIndex, float val)This Java Array Method assigns the user-specified Floating point value (val) to each and every element present in between the specified range of the array x
static voidfill(int[] x, int val)It assigns an Integer value (val) to each element of the array x
static voidfill(int[] x, int fromIndex, int toIndex, int val)It assigns an Integer value (val) to every element present in between the specified range of the array x
static voidfill(long[] x, long val)It assigns a Long value (val) to each element of the array x
static voidfill(long[] x, int fromIndex, int toIndex, long val)This Java Method assigns the Object(val) to all the x array elements.
static voidfill(Object[] x, Object val)It assigns the Object(val) to all the x array element.
static voidfill(Object[] x, int fromIndex, int toIndex, Object val)It assigns the Object(val) to all the x array elements.
static inthashCode(boolean[] a)This Java Method returns the Hashcode based on the contents of the Boolean, byte, int, short, float, double, long, and object array
static inthashCode(byte[] myArray)Hash code of the Byte
static inthashCode(char[] myArray)Hash code of the character
static inthashCode(short[] a)This Java Array Method returns the Hashcode based on the contents of the specified array
static inthashCode(double[] myArray)Hash code of the Double
static inthashCode(float[] myArray)Hash code of the Float
static inthashCode(int[] myArray)Hashcode of the Integer
static inthashCode(long[] myArray)This Java Method returns the Hashcode based on the contents of the Long Array
static inthashCode(Object[] myArray)Hash code of the Object
static voidsort(byte[] x)It Sorts the user specified Byte array into Ascending Numerical Order
static voidsort(byte[] x, int fromIndex, int toIndex)This assigns the user specified byte value(val) to each and every element present in between the specified range of the array x
static voidsort(char[] x)It Sorts the user specified Character array into Ascending Numerical Order
static voidsort(char[] x, int fromIndex, int toIndex)It assigns the user specified Character (val) to each element present in between the specified range of the array x
static voidsort(short[] x)This Java Method Sort the user specified short array into Ascending Numerical Order
static voidsort(short[] x, int fromIndex, int toIndex)It assigns the user given short value (val) to each and every element present in-between the specified range of the array x
static voidsort(double[] x)It Sorts the user specified Double array into Ascending Numerical Order
static voidsort(double[] x, int fromIndex, int toIndex)It assigns the user specified Double value (val) to every element present in between the specified range of the array x
static voidsort(float[] x, float val)This Java Array assigns the Floating point value (val) to each element of the array x
static voidsort(float[] x, int fromIndex, int toIndex, float val)It assigns a Floating point value (val) to every element present in between the specified range of the array x
static voidsort(int[] x, int val)It assigns the user specified Integer value (val) to each element of the array x
static voidsort(int[] x, int fromIndex, int toIndex, int val)This Java Method assigns the user-specified Integer value (val) to each and every element present in between the specified range of the array x
static voidsort(long[] x, long val)It assigns the user-specified Long value (val) to every element of the array x
static voidsort(long[] x, int fromIndex, int toIndex, long val)It assigns the Long value to each element within the specified range.
static voidsort(Object[] x, Object val)It assigns the user specified Object(val) to each and every element of the array x
static voidsort(Object[] x, int fromIndex, int toIndex, Object val)This Java Method assigns the user specified Object(val) to each and every element present in between the specified range of the array x
static StringtoString(boolean[] a)String representation of the Boolean array
static StringtoString(byte[] myByteArray)Byte array to string
static StringtoString(char[] myArray)Character array to string
static StringtoString(short[] a)Returns a string representation of the contents of the specified array
static StringtoString(double[] myArray)This Java method returns a string representation of the contents of the Double array
static StringtoString(float[] myArray)Float array to String
static StringtoString(int[] myArray)Integer array to String
static StringtoString(long[] myArray)Long array to String
static StringtoString(Object[] myArray)Java Array Method returns a string representation of the contents of the Object array.