### Question:
MerkleTree { static int[] orderNodes(int[] indexes) { if (indexes.length <= 2) { return indexes; } int[] res = new int[indexes.length]; List<Integer> list = new TreeList<>(); list.add(indexes[0]); list.add(indexes[1]); int position = 1; while (2 * position != indexes.length) { position <<= 1; int start = 1; for (int i = position; i < 2 * position; i++) { if (list.size() <= start) { list.add(indexes[i]); } else { list.add(start, indexes[i]); start += 2; } } } for (int i = 0; i < indexes.length; i++) { res[i] = list.get(i); } 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 testOrderNodes() { int[] ordered = MerkleTree.orderNodes(new int[]{0, 2, 4, 5, 8, 9, 10, 11}); Assertions.assertArrayEquals(new int[]{0, 8, 4, 9, 2, 10, 5, 11}, ordered); ordered = MerkleTree.orderNodes(new int[]{0, 2, 4, 5, 8, 9, 10, 11, 16, 17, 18, 19, 20, 21, 22, 23}); Assertions.assertArrayEquals(new int[]{0, 16, 8, 17, 4, 18, 9, 19, 2, 20, 10, 21, 5, 22, 11, 23}, ordered); }