code: public static int[] shape(int[] buffer) {
          int[] ret = new int[rank(buffer)];
          System.arraycopy(buffer, 1, ret, 0, ret.length);
          return ret;
      }
docs: Get array shape from an int[]
  @param buffer    Buffer to get the shape from
  @return          Shape array