Top Constructors Methods
org.bouncycastle.pqc.legacy.math.linearalgebra

public final Class IntUtils

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
private
IntUtils()

Default constructor (private).

Method Summary

Modifier and TypeMethod and Description
public static int[]

Returns:

the clone of the given array
clone
(int[]
the array to clone
array
)

Return a clone of the given int array.

public static boolean

Returns:

the result of the comparison
equals
(int[]
the first int array
left
,
int[]
the second int array
right
)

Compare two int arrays.

public static void
fill(int[]
the array
array
,
int
the value
value
)

Fill the given int array with the given value.

private static int

Returns:

the new index of the pivot element inside the array
partition
(int[]
the int array whose subarray will be splitted
source
,
int
the start position of the subarray
left
,
int
the end position of the subarray
right
,
int
the index of the pivot element inside the array
pivotIndex
)

Split a subarray of a source array into two partitions.

public static void
quicksort(int[]
the array of integers that needs to be sorted.
source
)

Sorts this array of integers according to the Quicksort algorithm.

public static void
quicksort(int[]
the int array to be sorted
source
,
int
the start index of the subarray
left
,
int
the end index of the subarray
right
)

Sort a subarray of a source array.

public static int[]

Returns:

a subarray of input, ranging from start to end
subArray
(final int[]
- the input int array
input
,
final int
- the start index
start
,
final int
- the end index
end
)

Generates a subarray of a given int array.

public static String

Returns:

the int array as hex string
toHexString
(int[]
an int arary
input
)

public static String

Returns:

a human readable form of the given int array
toString
(int[]
an int array
input
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

IntUtilsback to summary
private IntUtils()

Default constructor (private).

Method Detail

cloneback to summary
public static int[] clone(int[] array)

Return a clone of the given int array. No null checks are performed.

Parameters
array:int[]

the array to clone

Returns:int[]

the clone of the given array

equalsback to summary
public static boolean equals(int[] left, int[] right)

Compare two int arrays. No null checks are performed.

Parameters
left:int[]

the first int array

right:int[]

the second int array

Returns:boolean

the result of the comparison

fillback to summary
public static void fill(int[] array, int value)

Fill the given int array with the given value.

Parameters
array:int[]

the array

value:int

the value

partitionback to summary
private static int partition(int[] source, int left, int right, int pivotIndex)

Split a subarray of a source array into two partitions. The left partition contains elements that have value less than or equal to the pivot element, the right partition contains the elements that have larger value.

Parameters
source:int[]

the int array whose subarray will be splitted

left:int

the start position of the subarray

right:int

the end position of the subarray

pivotIndex:int

the index of the pivot element inside the array

Returns:int

the new index of the pivot element inside the array

quicksortback to summary
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:int[]

the array of integers that needs to be sorted.

quicksortback to summary
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:int[]

the int array to be sorted

left:int

the start index of the subarray

right:int

the end index of the subarray

subArrayback to summary
public static int[] subArray(final int[] input, final int start, final int end)

Generates a subarray of a given int array.

Parameters
input:int[]

- the input int array

start:int

- the start index

end:int

- the end index

Returns:int[]

a subarray of input, ranging from start to end

toHexStringback to summary
public static String toHexString(int[] input)
Parameters
input:int[]

an int arary

Returns:String

the int array as hex string

toStringback to summary
public static String toString(int[] input)
Parameters
input:int[]

an int array

Returns:String

a human readable form of the given int array