### Question:
MerkleTree { static int[][] getNodeIndexes(int size) { if (size < 2) { throw new IllegalArgumentException("Cannot find indexes for size: " + size); } if (!isPowerOfTwo(size)) { throw new IllegalArgumentException("Size is not power of two: " + size); } int[][] res = new int[2][]; int[] left = new int[size / 2]; int[] right = new int[size / 2]; res[0] = left; res[1] = right; left[0] = 0; right[0] = 1; int indexCounter = 1; int p = 1; int prev = 1 << p; int cur = 1 << p + 1; while (cur <= size) { int steps = (cur - prev) / 2; int mid = prev + steps; for (int i = 0; i < steps; i++) { left[indexCounter] = prev + i; right[indexCounter] = mid + i; indexCounter++; } p++; prev = 1 << p; cur = 1 << p + 1; } return res; } MerkleTree(MessageDigest digest);  MerkleTree(MessageDigest digest, List<byte[]> dataList); List<Node> getNodes(); List<Node> getLeaves(); Node getRoot(); void appendLeaf(Node node); void appendLeaves(Node[] nodes); void appendLeaf(byte[] value); void appendLeaves(byte[][] values); void appendHashedLeaves(byte[][] hashes); @Override boolean equals(Object o);  }### Answer:
@Test public void testGetNodeIndexes() { int[][] nodeIndexes = MerkleTree.getNodeIndexes(8); Assertions.assertArrayEquals(new int[][]{{0, 2, 4, 5}, {1, 3, 6, 7}}, nodeIndexes); nodeIndexes = MerkleTree.getNodeIndexes(16); Assertions.assertArrayEquals(new int[][]{{0, 2, 4, 5, 8, 9, 10, 11}, {1, 3, 6, 7, 12, 13, 14, 15}}, nodeIndexes); }