### Question:
MLLibUtil { public static INDArray toMatrix(Matrix arr) { return Nd4j.create(arr.toArray(), new int[] {arr.numRows(), arr.numCols()}, 'f'); } private  MLLibUtil(); static double toClassifierPrediction(Vector vector); static INDArray toMatrix(Matrix arr); static INDArray toVector(Vector arr); static Matrix toMatrix(INDArray arr); static Vector toVector(INDArray arr); static JavaRDD<LabeledPoint> fromBinary(JavaPairRDD<String, PortableDataStream> binaryFiles,
                    final RecordReader reader); static JavaRDD<LabeledPoint> fromBinary(JavaRDD<Tuple2<String, PortableDataStream>> binaryFiles,
                    final RecordReader reader); static LabeledPoint pointOf(Collection<Writable> writables); static JavaRDD<DataSet> fromLabeledPoint(JavaRDD<LabeledPoint> data, final long numPossibleLabels,
                    long batchSize); @Deprecated static JavaRDD<DataSet> fromLabeledPoint(JavaSparkContext sc, JavaRDD<LabeledPoint> data,
                    final long numPossibleLabels); @Deprecated static JavaRDD<DataSet> fromContinuousLabeledPoint(JavaSparkContext sc, JavaRDD<LabeledPoint> data); @Deprecated static JavaRDD<LabeledPoint> fromDataSet(JavaSparkContext sc, JavaRDD<DataSet> data); static JavaRDD<DataSet> fromContinuousLabeledPoint(JavaRDD<LabeledPoint> data); static JavaRDD<DataSet> fromContinuousLabeledPoint(JavaRDD<LabeledPoint> data, boolean preCache); static JavaRDD<DataSet> fromLabeledPoint(JavaRDD<LabeledPoint> data, final long numPossibleLabels); static JavaRDD<DataSet> fromLabeledPoint(JavaRDD<LabeledPoint> data, final long numPossibleLabels,
                    boolean preCache); static JavaRDD<LabeledPoint> fromDataSet(JavaRDD<DataSet> data); static JavaRDD<LabeledPoint> fromDataSet(JavaRDD<DataSet> data, boolean preCache);  }### Answer:
@Test public void testINDtoMLMatrix() { INDArray matIND = Nd4j.rand(23, 100); Matrix matMl = MLLibUtil.toMatrix(matIND); assertTrue(matrixEquals(matMl, matIND, 0.01)); }
@Test public void testMltoINDMatrix() { Matrix matMl = Matrices.randn(23, 100, new Random(3949955)); INDArray matIND = MLLibUtil.toMatrix(matMl); log.info("matrix shape: {}", Arrays.toString(matIND.shapeInfoDataBuffer().asInt())); assertTrue(matrixEquals(matMl, matIND, 0.01)); }