Java Utililty Methods Byte Array Create

List of utility methods to do Byte Array Create

Description

The list of methods to do Byte Array Create are organized into topic(s).

Method

byte[]toByteArray(String str)
Return a byte[] array from the string's chars, ANDed to the lowest 8 bits.
byte[] retour = new byte[str.length()];
for (int i = 0; i < str.length(); i++) {
    retour[i] = (byte) (str.charAt(i) & 0xFF);
return retour;
byte[]toByteArray(String str)
to Byte Array
char[] chars = str.toCharArray();
byte[] bytes = new byte[chars.length];
for (int i = 0; i != bytes.length; i++) {
    bytes[i] = (byte) chars[i];
return bytes;
byte[]toByteArray(String str, String separator)
Converts a string of numbers to a byte array.
String[] fields = str.split(separator);
byte[] tmp = new byte[fields.length];
for (int i = 0; i < tmp.length; i++)
    tmp[i] = Byte.parseByte(fields[i]);
return tmp;
byte[]toByteArray(String string)
to Byte Array
int count = string.length() / 2;
byte[] result = new byte[count];
for (int i = 0; i < count; i++) {
    char c1 = string.charAt(i * 2);
    char c2 = string.charAt(i * 2 + 1);
    result[i] = (byte) ((unhex(c1) << 4) | unhex(c2));
return result;
...
byte[]toByteArray(String string)
Convert the passed in String to a byte array by taking the bottom 8 bits of each character it contains.
byte[] bytes = new byte[string.length()];
char[] chars = string.toCharArray();
for (int i = 0; i != chars.length; i++) {
    bytes[i] = (byte) chars[i];
return bytes;
byte[]toByteArray(String strTransInfo)
convert string of transaction's info into byte array
if (!strTransInfo.equals(null) || !strTransInfo.equals("")) {
    byte byteTransInfo[] = strTransInfo.getBytes();
    return byteTransInfo;
} else {
    return null;
byte[]toByteArray(String uid)
Converts a UID formatted String to a byte[].
if (isUID(uid)) {
    byte[] result = new byte[16];
    char[] chars = uid.toCharArray();
    int r = 0;
    for (int i = 0; i < chars.length; i++) {
        if (chars[i] == '-')
            continue;
        int h1 = Character.digit(chars[i], 16);
...
byte[]toByteArray(String value)
to Byte Array
int i, j;
int len = value.length();
if (value == null) {
    return null;
} else if (value == "") {
    return null;
} else if ((len % 2) != 0) {
    return null;
...
byte[]toByteArray(String[] anArray)
to Byte Array
byte[] output = new byte[anArray.length];
for (int index = 0; index < anArray.length; index++)
    output[index] = Byte.parseByte(anArray[index]);
return output;
byte[]toByteArray1D(int[][] d)
to Byte Array D
byte[] ret = new byte[d.length * d[0].length];
int k = 0;
for (int i = 0; i < d.length; i++) {
    for (int j = 0; j < d[0].length; j++) {
        ret[k++] = (byte) d[i][j];
return ret;
...