Class IntUtils
java.lang.Object
org.bouncycastle.pqc.legacy.math.linearalgebra.IntUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic int[]
clone
(int[] array) Return a clone of the given int array.static boolean
equals
(int[] left, int[] right) Compare two int arrays.static void
fill
(int[] array, int value) Fill the given int array with the given value.static void
quicksort
(int[] source) Sorts this array of integers according to the Quicksort algorithm.static void
quicksort
(int[] source, int left, int right) Sort a subarray of a source array.static int[]
subArray
(int[] input, int start, int end) Generates a subarray of a given int array.static String
toHexString
(int[] input) static String
toString
(int[] input)
-
Method Details
-
equals
public static boolean equals(int[] left, int[] right) Compare two int arrays. No null checks are performed.- Parameters:
left
- the first int arrayright
- the second int array- Returns:
- the result of the comparison
-
clone
public static int[] clone(int[] array) Return a clone of the given int array. No null checks are performed.- Parameters:
array
- the array to clone- Returns:
- the clone of the given array
-
fill
public static void fill(int[] array, int value) Fill the given int array with the given value.- Parameters:
array
- the arrayvalue
- the value
-
quicksort
public static void quicksort(int[] source) Sorts this array of integers according to the Quicksort algorithm. After calling this method this array is sorted in ascending order with the smallest integer taking position 0 in the array.This implementation is based on the quicksort algorithm as described in
Data Structures In Java
by Thomas A. Standish, Chapter 10, ISBN 0-201-30564-X.- Parameters:
source
- the array of integers that needs to be sorted.
-
quicksort
public static void quicksort(int[] source, int left, int right) Sort a subarray of a source array. The subarray is specified by its start and end index.- Parameters:
source
- the int array to be sortedleft
- the start index of the subarrayright
- the end index of the subarray
-
subArray
public static int[] subArray(int[] input, int start, int end) Generates a subarray of a given int array.- Parameters:
input
- - the input int arraystart
- - the start indexend
- - the end index- Returns:
- a subarray of input, ranging from start to end
-
toString
- Parameters:
input
- an int array- Returns:
- a human readable form of the given int array
-
toHexString
- Parameters:
input
- an int arary- Returns:
- the int array as hex string
-