diff --git a/core/src/main/java/org/bitcoinj/core/Utils.java b/core/src/main/java/org/bitcoinj/core/Utils.java index 574858b37..6fb69a921 100644 --- a/core/src/main/java/org/bitcoinj/core/Utils.java +++ b/core/src/main/java/org/bitcoinj/core/Utils.java @@ -174,27 +174,6 @@ public class Utils { return buf; } - /** - * Returns a copy of the given byte array with the bytes of each double-word (4 bytes) reversed. - * - * @param bytes length must be divisible by 4. - * @param trimLength trim output to this length. If positive, must be divisible by 4. - */ - public static byte[] reverseDwordBytes(byte[] bytes, int trimLength) { - checkArgument(bytes.length % 4 == 0); - checkArgument(trimLength < 0 || trimLength % 4 == 0); - - byte[] rev = new byte[trimLength >= 0 && bytes.length > trimLength ? trimLength : bytes.length]; - - for (int i = 0; i < rev.length; i += 4) { - System.arraycopy(bytes, i, rev, i , 4); - for (int j = 0; j < 4; j++) { - rev[i + j] = bytes[i + 3 - j]; - } - } - return rev; - } - /** Parse 4 bytes from the byte array (starting at the offset) as unsigned 32-bit integer in little endian format. */ public static long readUint32(byte[] bytes, int offset) { return (bytes[offset] & 0xffl) | diff --git a/core/src/test/java/org/bitcoinj/core/UtilsTest.java b/core/src/test/java/org/bitcoinj/core/UtilsTest.java index 7c8bd957e..281d803eb 100644 --- a/core/src/test/java/org/bitcoinj/core/UtilsTest.java +++ b/core/src/test/java/org/bitcoinj/core/UtilsTest.java @@ -33,14 +33,6 @@ public class UtilsTest { assertArrayEquals(new byte[]{1, 2, 3, 4, 5}, Utils.reverseBytes(new byte[]{5, 4, 3, 2, 1})); } - @Test - public void testReverseDwordBytes() { - assertArrayEquals(new byte[]{1, 2, 3, 4, 5, 6, 7, 8}, Utils.reverseDwordBytes(new byte[]{4, 3, 2, 1, 8, 7, 6, 5}, -1)); - assertArrayEquals(new byte[]{1, 2, 3, 4}, Utils.reverseDwordBytes(new byte[]{4, 3, 2, 1, 8, 7, 6, 5}, 4)); - assertArrayEquals(new byte[0], Utils.reverseDwordBytes(new byte[]{4, 3, 2, 1, 8, 7, 6, 5}, 0)); - assertArrayEquals(new byte[0], Utils.reverseDwordBytes(new byte[0], 0)); - } - @Test public void testMaxOfMostFreq() throws Exception { assertEquals(0, Utils.maxOfMostFreq());