mirror of
https://github.com/Qortal/AT.git
synced 2025-02-15 03:35:52 +00:00
22 lines
524 B
Java
22 lines
524 B
Java
package common;
|
|
|
|
import java.math.BigInteger;
|
|
|
|
public class TestUtils {
|
|
|
|
public static byte[] hexToBytes(String hex) {
|
|
byte[] output = new byte[hex.length() / 2];
|
|
byte[] converted = new BigInteger("00" + hex, 16).toByteArray();
|
|
|
|
int convertedLength = Math.min(output.length, converted.length);
|
|
int convertedStart = converted.length - convertedLength;
|
|
|
|
int outputStart = output.length - convertedLength;
|
|
|
|
System.arraycopy(converted, convertedStart, output, outputStart, convertedLength);
|
|
|
|
return output;
|
|
}
|
|
|
|
}
|