static int getLeftMostLeafUnderNode(int nodeOrder, int depth) {
        if (isLeaf(nodeOrder, depth)) {
            return nodeOrder;
        }

        int leafLevel = depth - 1;
        int levelOfNode = getLevelOfNode(nodeOrder);
        int distanceFromLeafLevel = depth - levelOfNode - 1;
        int leftMostNodeOrderOnLevel = getLeftMostNodeOrderOnLevel(levelOfNode);
        int relativeLevelOrder = nodeOrder - leftMostNodeOrderOnLevel;
        int leftMostLeaf = getLeftMostNodeOrderOnLevel(leafLevel);

        return leftMostLeaf + (2 << distanceFromLeafLevel - 1) * relativeLevelOrder;
    }
@Test
    public void testGetLeftMostLeafUnderNode() {
        // depth 1
        assertEquals(0, MerkleTreeUtil.getLeftMostLeafUnderNode(0, 1));

        // depth 2
        assertEquals(1, MerkleTreeUtil.getLeftMostLeafUnderNode(0, 2));
        assertEquals(1, MerkleTreeUtil.getLeftMostLeafUnderNode(1, 2));
        assertEquals(2, MerkleTreeUtil.getLeftMostLeafUnderNode(2, 2));

        // depth 3
        assertEquals(3, MerkleTreeUtil.getLeftMostLeafUnderNode(0, 3));
        assertEquals(3, MerkleTreeUtil.getLeftMostLeafUnderNode(1, 3));
        assertEquals(5, MerkleTreeUtil.getLeftMostLeafUnderNode(2, 3));

        // depth 4
        assertEquals(7, MerkleTreeUtil.getLeftMostLeafUnderNode(0, 4));
        assertEquals(7, MerkleTreeUtil.getLeftMostLeafUnderNode(1, 4));
        assertEquals(11, MerkleTreeUtil.getLeftMostLeafUnderNode(2, 4));
        assertEquals(7, MerkleTreeUtil.getLeftMostLeafUnderNode(3, 4));
        assertEquals(9, MerkleTreeUtil.getLeftMostLeafUnderNode(4, 4));
        assertEquals(11, MerkleTreeUtil.getLeftMostLeafUnderNode(5, 4));
        assertEquals(13, MerkleTreeUtil.getLeftMostLeafUnderNode(6, 4));
    }