public class Array
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static char[] |
HEX |
static java.lang.String |
STR_FORBIDDEN_OPERATION |
Constructor and Description |
---|
Array() |
Modifier and Type | Method and Description |
---|---|
static int[] |
addFollowingZeros(int[] mag,
int n)
Adds the specified amount of following zeros to the specified int array
|
static java.lang.String[] |
avoidRepeats(java.lang.String[] source)
Возвращает массив строк без повторений.
|
static void |
byteOrder(byte[] data)
change byte order in every int for byte array with restore
|
static int |
byteOrder(int data)
change byte order in int
|
static void |
byteOrder(int[] data)
change byte order in every int for int array with restore
|
static byte[] |
byteOrderB(byte[] data)
change byte order in every int for byte array and return new byte array
|
static int[] |
byteOrderI(int[] data)
change byte order in every int for int array and return new int array
|
static void |
clear(byte[] data)
clear byte array
|
static void |
clear(char[] data)
clear int array
|
static void |
clear(int[] data)
clear int array
|
static void |
clear(long[] data)
clear long array
|
static void |
clear(short[] data)
clear short array
|
static boolean |
compare(byte[] first,
byte[] second)
Сравнение двух байтовых массивов.
|
static boolean |
compare(byte[] first,
byte[] second,
int len)
Сравнение двух байтовых массивов по первым
len байтам. |
static boolean |
compare(byte[] first,
int firstPos,
byte[] second,
int secondPos,
int len)
Сравнение двух частей байтовых массивов по
len байтам. |
static boolean |
compare(char[] first,
char[] second,
int len)
Сравнение двух char массивов по первым
len int. |
static boolean |
compare(int[] first,
int[] second)
Сравнение двух int массивов.
|
static boolean |
compare(int[] first,
int[] second,
int len)
Сравнение двух int массивов по первым
len int. |
static byte[] |
copy(byte[] source) |
static void |
copy(byte[] source,
byte[] res) |
static void |
copy(byte[] source,
int sourceOffset,
byte[] dst,
int dstOffset,
int count)
копирование из одного массива в другой, со смещениями, отрезка определенной
длины.
|
static int[] |
copy(int[] source) |
static void |
copy(int[] source,
int[] res) |
static void |
copy(int[] source,
int sourceOffset,
int[] dst,
int dstOffset,
int count)
копирование из одного массива в другой, со смещениями, отрезка определенной
длины.
|
static void |
copyRestricted(byte[] source,
int sourceOffset,
byte[] dst,
int dstOffset,
int count)
копирование из одного массива в другой, со смещениями, отрезка определенной
длины.
|
static void |
copyRestricted(int[] source,
int sourceOffset,
int[] dst,
int dstOffset,
int count)
копирование из одного массива в другой, со смещениями, отрезка определенной
длины.
|
static int |
getInt(byte[] array,
int offset) |
static int |
getIntBE(byte[] array,
int offset) |
static long |
getLong(byte[] array,
int offset) |
static long |
getLongBE(byte[] array,
int offset)
Функция преобразования массима в long в BE.
|
static short |
getShort(byte[] array,
int offset) |
static void |
intOrder(int[] data)
change int order in int array with restore
|
static int[] |
intOrderI(int[] data)
change int order in int array and return new int array
|
static void |
invByteOrder(byte[] data)
inverse byte order in byte array with restore
|
static void |
invByteOrder(int[] data)
inverse byte order in int array with restore
|
static byte[] |
invByteOrderB(byte[] data)
inverse byte order in data array and return new ByteArray
|
static byte[] |
invByteOrderB(int[] data)
inverse byte order in int array and return new byte array
|
static int[] |
invByteOrderI(int[] data)
inverse byte order in int array and return new int array
|
static boolean |
isZero(int[] a)
Проверяет, является ли нулевым int'овый массив
|
static char[] |
leftPart(char[] source,
int index)
Returns the left part of the char array with the specified length
|
static int[] |
leftPart(int[] source,
int index)
Returns the left part of the int array with the specified length
|
static double |
max(double[] a) |
static int |
max(int[] a) |
static byte[] |
merge(byte[] a,
byte[] b)
Merges two byte arrays into one
|
static char[] |
merge(char[] a,
char[] b)
Merges two char arrays into one
|
static int[] |
merge(int[] a,
int[] b)
Merges two int arrays into one
|
static java.lang.String[] |
merge(java.lang.String[] a,
java.lang.String[] b)
Merges two String arrays into one
|
static double |
min(double[] a) |
static int |
min(int[] a) |
static void |
outHex(java.io.PrintStream stream,
byte[] data) |
static void |
outHex(java.io.PrintStream stream,
byte[] data,
int off,
int len) |
static void |
printHexInt(java.io.PrintStream stream,
int a) |
static byte[] |
readFile(java.io.File f)
read file.
|
static byte[] |
readFile(java.lang.String name)
read file.
|
static java.lang.String[] |
removeElement(java.lang.String[] args,
int index)
Удаляет указанный элемент из массива строк.
|
static byte[] |
rightPart(byte[] source,
int index)
Returns the right part of the byte array starting from the element with the
specified index
|
static char[] |
rightPart(char[] source,
int index)
Returns the right part of the char array starting from the element with the
specified index
|
static int[] |
rightPart(int[] source,
int index)
Returns the right part of the int array starting from the element with the
specified index
|
static void |
separate(char[] source,
char[] left,
char[] right,
int index)
Performs the separation of the left part of the char array from it's right
part
|
static void |
separate(int[] source,
int[] left,
int[] right,
int index)
Performs the separation of the left part of the int array from it's right
part
|
static void |
shiftIntLeft(int[] mag,
int a)
Сдвигает массив int'ов влево на a позиций с сохранением
|
static int[] |
shiftIntLeftNew(int[] mag,
int a)
Сдвигает массив int'ов влево на a позиций
|
static void |
storeInBeg(char[] source,
char[] input)
Stores the char array into the beginning of another char array If the source
array is smaller, exception is thrown
|
static void |
storeInEnd(char[] source,
char[] input)
Stores the char array into the end of another char array If the source array
is smaller, exception is thrown
|
static void |
toByteArray(byte[] res,
int[] data) |
static void |
toByteArray(byte[] res,
int resOffset,
int[] data,
int dataOffset) |
static byte[] |
toByteArray(int data) |
static byte[] |
toByteArray(int[] data)
to byte array (CSP order) - change byte order in every int for int array and
return new byte array
|
static byte[] |
toByteArray(int[] data,
int offset,
int length) |
static byte[] |
toByteArray(long data) |
static byte[] |
toByteArray(short data) |
static byte[] |
toByteArrayI(int data) |
static byte[] |
toByteArrayI(long data) |
static void |
toByteArrayXOR(byte[] res,
int resOffset,
int[] data,
byte[] xorAr,
int xorOffset) |
static java.lang.String |
toHexLowString(byte[] array)
перевод байтового массива в печатную строку.
|
static java.lang.String |
toHexString(byte[] array) |
static java.lang.String |
toHexString(byte[] array,
int off) |
static java.lang.String |
toHexString(int[] array) |
static int[] |
toIntArray(byte[] data)
to int array (CSP order)
|
static void |
toIntArray(int[] res,
byte[] data)
to int array (CSP order)
|
static int[] |
toIntArray(short[] data)
to int array (CSP order) from short array - for gost digest
|
static int[] |
toIntArrayR(byte[] data)
inverse byte order in data array and return new IntArray (CSP-order)
|
static short[] |
toShortArray(int[] data)
to short array (CSP order) from int array - for gost digest
|
static void |
writeFile(java.io.File f,
byte[] data)
write file.
|
static void |
writeFile(java.lang.String name,
byte[] data)
write file.
|
static byte[] |
xor(byte[] a,
byte[] b)
Performs xor operation for 2 byte arrays
|
static int[] |
xor(int[] a,
int[] b)
Performs xor operation for 2 int arrays
|
public static final java.lang.String STR_FORBIDDEN_OPERATION
public static final char[] HEX
public static int[] copy(int[] source)
public static void copy(int[] source, int[] res)
public static void copy(byte[] source, byte[] res)
public static void copyRestricted(int[] source, int sourceOffset, int[] dst, int dstOffset, int count)
source
- исходный массивsourceOffset
- неотрицательное смещение в исходном массивеdst
- массив назначенияdstOffset
- неотрицательное смещение в массиве назначенияcount
- неотрицательное количество символов для копированияpublic static void copy(int[] source, int sourceOffset, int[] dst, int dstOffset, int count)
source
- исходный массивsourceOffset
- неотрицательное смещение в исходном массивеdst
- массив назначенияdstOffset
- неотрицательное смещение в массиве назначенияcount
- неотрицательное количество символов для копированияpublic static void copyRestricted(byte[] source, int sourceOffset, byte[] dst, int dstOffset, int count)
source
- исходный массивsourceOffset
- неотрицательное смещение в исходном массивеdst
- массив назначенияdstOffset
- неотрицательное смещение в массиве назначенияcount
- неотрицательное количество символов для копированияpublic static void copy(byte[] source, int sourceOffset, byte[] dst, int dstOffset, int count)
source
- исходный массивsourceOffset
- неотрицательное смещение в исходном массивеdst
- массив назначенияdstOffset
- неотрицательное смещение в массиве назначенияcount
- неотрицательное количество символов для копированияpublic static byte[] copy(byte[] source)
public static boolean compare(byte[] first, byte[] second, int len)
len
байтам.first
- первый массивsecond
- второй массивlen
- длина для сравненияpublic static boolean compare(int[] first, int[] second, int len)
len
int.first
- первый массивsecond
- второй массивlen
- длина для сравнения в intpublic static boolean compare(byte[] first, int firstPos, byte[] second, int secondPos, int len)
len
байтам.first
- первый массивfirstPos
- начальная позиция для сравнения в первом массивеsecond
- второй массивsecondPos
- начальная позиция для сравнения во втором массивеlen
- длина для сравненияpublic static boolean compare(char[] first, char[] second, int len)
len
int.first
- первый массивsecond
- второй массивlen
- длина для сравненияpublic static boolean compare(byte[] first, byte[] second)
first
- первый массивsecond
- второй массивpublic static boolean compare(int[] first, int[] second)
first
- первый массивsecond
- второй массивpublic static int[] shiftIntLeftNew(int[] mag, int a)
mag
- массивa
- индекс сдвигаpublic static void shiftIntLeft(int[] mag, int a)
mag
- массивa
- индекс сдвигаpublic static void byteOrder(int[] data)
public static int byteOrder(int data)
public static int[] byteOrderI(int[] data)
public static byte[] toByteArray(int[] data)
public static byte[] toByteArray(int[] data, int offset, int length)
public static void toByteArray(byte[] res, int[] data)
public static void toByteArray(byte[] res, int resOffset, int[] data, int dataOffset)
public static void toByteArrayXOR(byte[] res, int resOffset, int[] data, byte[] xorAr, int xorOffset)
public static short getShort(byte[] array, int offset)
public static long getLong(byte[] array, int offset)
public static long getLongBE(byte[] array, int offset)
array
- offset
- public static byte[] toByteArray(short data)
public static byte[] toByteArray(int data)
public static byte[] toByteArrayI(int data)
public static byte[] toByteArray(long data)
public static byte[] toByteArrayI(long data)
public static void intOrder(int[] data)
public static int[] intOrderI(int[] data)
public static void invByteOrder(int[] data)
public static int[] invByteOrderI(int[] data)
public static byte[] invByteOrderB(int[] data)
public static void byteOrder(byte[] data)
public static byte[] byteOrderB(byte[] data)
public static int[] toIntArray(byte[] data)
public static void toIntArray(int[] res, byte[] data)
public static void invByteOrder(byte[] data)
public static byte[] invByteOrderB(byte[] data)
public static int[] toIntArrayR(byte[] data)
public static short[] toShortArray(int[] data)
public static int[] toIntArray(short[] data)
public static void clear(long[] data)
public static void clear(int[] data)
public static void clear(char[] data)
public static void clear(byte[] data)
public static void clear(short[] data)
public static int getInt(byte[] array, int offset)
public static int getIntBE(byte[] array, int offset)
public static int[] addFollowingZeros(int[] mag, int n)
mag
- - исходный массивn
- - количество добавляемых нулейpublic static boolean isZero(int[] a)
a
- - массивpublic static byte[] merge(byte[] a, byte[] b)
a
- - первый массивb
- - второй массивpublic static int[] merge(int[] a, int[] b)
a
- - первый массивb
- - второй массивpublic static java.lang.String[] merge(java.lang.String[] a, java.lang.String[] b)
a
- - первый массивb
- - второй массивpublic static char[] merge(char[] a, char[] b)
a
- - первый массивb
- - второй массивpublic static void separate(char[] source, char[] left, char[] right, int index)
source
- the source char arrayleft
- the left resulting arrayright
- the right resulting arrayindex
- index of separationpublic static void separate(int[] source, int[] left, int[] right, int index)
source
- the source int arrayleft
- the left resulting arrayright
- the right resulting arrayindex
- index of separationpublic static char[] rightPart(char[] source, int index)
source
- - the source arrayindex
- - starting index of the result arraypublic static int[] rightPart(int[] source, int index)
source
- - the source arrayindex
- - starting index of the result arraypublic static byte[] rightPart(byte[] source, int index)
source
- - the source arrayindex
- - starting index of the result arraypublic static int[] leftPart(int[] source, int index)
source
- - source int arrayindex
- - lengthpublic static char[] leftPart(char[] source, int index)
source
- - source char arrayindex
- - lengthpublic static void storeInEnd(char[] source, char[] input)
source
- - куда копируемinput
- - копируемый массивpublic static void storeInBeg(char[] source, char[] input)
source
- - куда копируемinput
- - копируемый массивpublic static int[] xor(int[] a, int[] b)
a
- - первый массивb
- - второй массивpublic static byte[] xor(byte[] a, byte[] b)
a
- - первый массивb
- - второй массивpublic static double max(double[] a)
a
- - исходный массивpublic static double min(double[] a)
a
- - исходный массивpublic static int max(int[] a)
a
- - исходный массивpublic static int min(int[] a)
a
- - исходный массивpublic static java.lang.String[] removeElement(java.lang.String[] args, int index)
args
- - массив строкindex
- - индекс удаляемого элементаpublic static java.lang.String[] avoidRepeats(java.lang.String[] source)
source
- - исходный массив строк.public static void writeFile(java.io.File f, byte[] data) throws java.io.IOException
f
- filedata
- bufferjava.io.IOException
- if error occured.public static byte[] readFile(java.io.File f) throws java.io.IOException
f
- filejava.io.IOException
- if error occured.public static void writeFile(java.lang.String name, byte[] data) throws java.io.IOException
name
- file namedata
- bufferjava.io.IOException
- if error occured.public static byte[] readFile(java.lang.String name) throws java.io.IOException
name
- file namejava.io.IOException
- if error occured.public static java.lang.String toHexLowString(byte[] array)
array
- массивpublic static void outHex(java.io.PrintStream stream, byte[] data, int off, int len)
public static void outHex(java.io.PrintStream stream, byte[] data)
public static java.lang.String toHexString(byte[] array)
public static java.lang.String toHexString(int[] array)
public static java.lang.String toHexString(byte[] array, int off)
public static void printHexInt(java.io.PrintStream stream, int a)