nd4j-common/src/main/java/org/nd4j/linalg/util/MathUtils.java
public static List<double[]> coordSplit(List<Double> vector) {

        if (vector == null)
            return null;
        List<double[]> ret = new ArrayList<double[]>();
        /* x coordinates */
        double[] xVals = new double[vector.size() / 2];
        /* y coordinates */
        double[] yVals = new double[vector.size() / 2];
        /* current points */
        int xTracker = 0;
        int yTracker = 0;
        for (int i = 0; i < vector.size(); i++) {
            //even value, x coordinate
            if (i % 2 == 0)
                xVals[xTracker++] = vector.get(i);
            //y coordinate
            else
                yVals[yTracker++] = vector.get(i);
        }
        ret.add(xVals);
        ret.add(yVals);

        return ret;
    }
public static List<double[]> coordSplit(List<Double> vector) {

        if (vector == null)
            return null;
        List<double[]> ret = new ArrayList<double[]>();
        /* x coordinates */
        double[] xVals = new double[vector.size() / 2];
        /* y coordinates */
        double[] yVals = new double[vector.size() / 2];
        /* current points */
        int xTracker = 0;
        int yTracker = 0;
        for (int i = 0; i < vector.size(); i++) {
            //even value, x coordinate
            if (i % 2 == 0)
                xVals[xTracker++] = vector.get(i);
            //y coordinate
            else
                yVals[yTracker++] = vector.get(i);
        }
        ret.add(xVals);
        ret.add(yVals);

        return ret;
    }
public static List < double [ ] > coordSplit ( List < Double > vector ) { if ( vector == null ) return null ; List < double [ ] > ret = new ArrayList < double [ ] > ( ) ; /* x coordinates */ double [ ] xVals = new double [ vector . size ( ) / 2 ] ; /* y coordinates */ double [ ] yVals = new double [ vector . size ( ) / 2 ] ; /* current points */ int xTracker = 0 ; int yTracker = 0 ; for ( int i = 0 ; i < vector . size ( ) ; i ++ ) { //even value, x coordinate if ( i % 2 == 0 ) xVals [ xTracker ++ ] = vector . get ( i ) ; //y coordinate else yVals [ yTracker ++ ] = vector . get ( i ) ; } ret . add ( xVals ) ; ret . add ( yVals ) ; return ret ; }
This returns the coordinate split in a list of coordinates
such that the values for ret[0] are the x values
and ret[1] are the y values

@param vector the vector to split with x and y values
Note that the list will be more stable due to the size operator.
The array version will have extraneous values if not monitored
properly.
@return a coordinate split for the given vector of values.
if null, is passed in null is returned
This returns the coordinate split in a list of coordinates such that the values for ret [ 0 ] are the x values and ret [ 1 ] are the y values