public class PaperClipsUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static int[] |
copy(int[] array)
Returns a copy of the array.
|
static int[][] |
copy(int[][] array)
Returns a deep copy of the array.
|
static void |
dispose(java.util.List<PrintPiece> pages)
Disposes the print pieces in the list.
|
static void |
dispose(PrintPiece piece)
Disposes the print piece if not null.
|
static void |
dispose(PrintPiece[] pieces)
Disposes the print pieces that are not null.
|
static void |
dispose(PrintPiece[] pages,
int start,
int end)
Disposes the print pieces in the array from start (inclusive) to end
(exclusive).
|
static void |
dispose(PrintPiece p1,
PrintPiece p2)
Disposes the arguments that are not null.
|
static void |
dispose(PrintPiece piece,
PrintPiece[] pieces)
Disposes the print pieces that are not null.
|
static int |
firstMatch(int value,
int[] masks,
int defaultMask)
Returns the first element in masks where (value & mask[index]) ==
mask[index].
|
static int |
sum(int[] array)
Returns the sum of all elements in the array.
|
static int |
sum(int[] array,
int start,
int count)
Returns the sum of all elements in the array in the range
[start, start+count). |
static int |
sumByIndex(int[] array,
int[] indices)
Returns the sum of all elements in the array at the given indices.
|
static int[] |
toIntArray(java.util.List<java.lang.Integer> list)
Converts the argument to an int[] array.
|
static int[][] |
toIntIntArray(java.util.List<int[]> list)
Converts the argument to an int[][] array.
|
public static void dispose(PrintPiece piece)
piece - the print piece to dispose.public static void dispose(PrintPiece p1, PrintPiece p2)
p1 - print piece to disposep2 - print piece to disposepublic static void dispose(PrintPiece[] pieces)
pieces - array of print pieces to dispose.public static void dispose(PrintPiece[] pages, int start, int end)
pages - array of print pieces to dispose.start - the start index.end - the end index.public static void dispose(java.util.List<PrintPiece> pages)
pages - list of print pieces to dispose.public static void dispose(PrintPiece piece, PrintPiece[] pieces)
piece - a print piece to disposepieces - array of print pieces to disposepublic static int[] copy(int[] array)
array - the array to copypublic static int[][] copy(int[][] array)
array - the array to copypublic static int sum(int[] array)
array - the arraypublic static int sum(int[] array,
int start,
int count)
[start, start+count).array - the array containing the elements to add up.start - the index of the first element to add.count - the number of elements to add.public static int sumByIndex(int[] array,
int[] indices)
array - the array of elements to add up.indices - the indices of the elements in the array to add up.public static int[] toIntArray(java.util.List<java.lang.Integer> list)
list - a List of Integers.public static int[][] toIntIntArray(java.util.List<int[]> list)
list - a List of int[] arrays.public static int firstMatch(int value,
int[] masks,
int defaultMask)
value - the value to matchmasks - the possible values.defaultMask - the value to return if no match is found.