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

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

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

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

        return ret;
    }
public static List < double [ ] > coordSplit ( double [ ] vector ) { if ( vector == null ) return null ; List < double [ ] > ret = new ArrayList < double [ ] > ( ) ; /* x coordinates */ double [ ] xVals = new double [ vector . length / 2 ] ; /* y coordinates */ double [ ] yVals = new double [ vector . length / 2 ] ; /* current points */ int xTracker = 0 ; int yTracker = 0 ; for ( int i = 0 ; i < vector . length ; i ++ ) { //even value, x coordinate if ( i % 2 == 0 ) xVals [ xTracker ++ ] = vector [ i ] ; //y coordinate else yVals [ yTracker ++ ] = vector [ 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/
@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