nd4j-common/src/main/java/org/nd4j/linalg/util/MathUtils.java
public static List<List<Double>> partitionVariable(List<Double> arr, int chunk) {
        int count = 0;
        List<List<Double>> ret = new ArrayList<List<Double>>();


        while (count < arr.size()) {

            List<Double> sublist = arr.subList(count, count + chunk);
            count += chunk;
            ret.add(sublist);

        }
        //All data sets must be same size
        for (List<Double> lists : ret) {
            if (lists.size() < chunk)
                ret.remove(lists);
        }
        return ret;
    }
public static List<List<Double>> partitionVariable(List<Double> arr, int chunk) {
        int count = 0;
        List<List<Double>> ret = new ArrayList<List<Double>>();


        while (count < arr.size()) {

            List<Double> sublist = arr.subList(count, count + chunk);
            count += chunk;
            ret.add(sublist);

        }
        //All data sets must be same size
        for (List<Double> lists : ret) {
            if (lists.size() < chunk)
                ret.remove(lists);
        }
        return ret;
    }
public static List < List < Double > > partitionVariable ( List < Double > arr , int chunk ) { int count = 0 ; List < List < Double > > ret = new ArrayList < List < Double > > ( ) ; while ( count < arr . size ( ) ) { List < Double > sublist = arr . subList ( count , count + chunk ) ; count += chunk ; ret . add ( sublist ) ; } //All data sets must be same size for ( List < Double > lists : ret ) { if ( lists . size ( ) < chunk ) ret . remove ( lists ) ; } return ret ; }
This will partition the given whole variable data applyTransformToDestination in to the specified chunk number.

@param arr   the data applyTransformToDestination to pass in
@param chunk the number to separate by
@return a partition data applyTransformToDestination relative to the passed in chunk number
This will partition the given whole variable data applyTransformToDestination in to the specified chunk number .