nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java
public static int[] shape(int[] buffer) {
        int[] ret = new int[rank(buffer)];
        for (int i = 0; i < ret.length; i++)
            ret[i] = buffer[1 + i];
        return ret;
    }
public static int[] shape(int[] buffer) {
        int[] ret = new int[rank(buffer)];
        for (int i = 0; i < ret.length; i++)
            ret[i] = buffer[1 + i];
        return ret;
    }
Get array shape from an int[]
@param buffer    Buffer to get the shape from
@return          Shape array