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

    public  MerkleTree(MessageDigest digest);
    public  MerkleTree(MessageDigest digest, List<byte[]> dataList);

}