code: public static int length(IntBuffer buffer) {
          int ret = 1;
          IntBuffer shape = Shape.shapeOf(buffer);
          int rank = Shape.rank(buffer);
          for (int i = 0; i < rank; i++)
              ret *= shape.get(i);
          return ret;
      }
docs: Gets the rank given the shape info buffer
  @param buffer the buffer to get the rank for
  @return the rank for the shape buffer