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

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

}