### Question:
DenseMatrix extends Matrix { @Override public String toString() { final DecimalFormat format = FormatUtils.getDefaultDecimalFormat(); final StringBuilder builder = new StringBuilder(); this.forEach( (r, c, v) -> { if (0 != r && 0 == c) { builder.append(System.lineSeparator()); } if (0 != c) { builder.append(" "); } builder.append(format.format(v)); }); return builder.toString(); } DenseMatrix(final int rows, final int cols);  DenseMatrix(final int rows, final int cols, final double[] values); double[] getRaw(); @Override MatrixNonZeroElementRowIterator getNonZeroElementRowIterator(final int row); @Override String toString();  }### Answer:
@Test public void denseMatrixStringRepresentationIsCorrect() { final Matrix matrix = this.createMatrix(3, 2, new double[] {2.1234, 11.1234, 3.2345, 1, 5012.0126, 8}); final String expectedResult = "2.123 11.123" + System.lineSeparator() + "3.235 1.000" + System.lineSeparator() + "5012.013 8.000"; MatcherAssert.assertThat(matrix.toString(), IsEqual.equalTo(expectedResult)); }