Basic implicit tree implementation in Java
More efficient and accurate is a bit shift.

this.treeArray =  new int[(int) Math.pow(2, treeDepth)];
treeArray =  new int[1 &lt;&lt; treeDepth];


A test is in order for the top:

if (0 &gt; treeDepth || treeDepth &gt; 31) {
    throw new IllegalArgumentException();
}


The name returnRightSubTree is a bit irritating because of that return, synonymical yieldRightSubTree or get/create.

  public Tree returnLeftSubTree() {
    return yieldSubTree(false);
  }

  public Tree returnRightSubTree() {
    return yieldSubTree(true);
  }

  private Tree yieldSubTree(boolean right) {
    if (depth == 0) return null;

    Tree ret = new Tree(depth - 1);
    int[] trees = ret.getTreeArray();
    for (int i  = 1; i &lt; depth; i++) {
      int iTarget = 1 &lt;&lt; (i - 1);
      int iSource = (1 &lt;&lt; i) + (right ? 1 &lt;&lt; (i - 1)) : 0);
      for (int j  = 0; j &lt; depth - 1; j ++) {
        trees[iTarget + j] = trees[iSource + j];
      }
    }
    return ret;
  }


which could be faster using System.arraycopy:

  private Tree yieldSubTree(boolean right) {
    if (depth == 0) return null;

    Tree ret = new Tree(depth - 1);
    int[] trees = ret.getTreeArray();
    for (int i  = 1; i &lt; depth; i++) {
      int iTarget = 1 &lt;&lt; (i - 1);
      int iSource = (1 &lt;&lt; i) + (right ? 1 &lt;&lt; (i - 1)) : 0);
      System.arraycopy(trees, iSource, trees, iTarget, depth - 1);
    }
    return ret;
  }


The i dependent expression before the j loop. As you see, just as i++
one could have (but not necessarily):

    for (int i  = 1, iT = 1; i &lt; depth; i++, iT &lt;&lt;= 1) {
      //int iTarget = iT;
      int iSource = (iT &lt;&lt; 1) + (right ? iT : 0);


For the rest:

Tab indentation in java is 4. Historically a tab size of 3 was often for C/C++,
and for academic reasons: "there should be less long code with nesting in favour of
more methods" 4 was chosen; also as 8 was the archaic system tab size.

A tab size of 2 is still seen in XML/HTML, but I would refrain from that. Especially
as with lambdas one gets more unreadable indentations.