3
0
mirror of https://github.com/Qortal/AT.git synced 2025-02-15 03:35:52 +00:00
AT/Java/tests/common/TestUtils.java
catbref f0e031599d Initial upload of Java re-implementation
Note that this is unfinished, requiring fee-per-opcode support
and some refactoring.
2018-09-27 13:59:43 +01:00

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;
}
}