@Test
public void testToDenseVector() throws Exception {

    int[] indices = new int[]{1, 3, 5};
    double[] values = new double[]{1.0, 3.0, 5.0};
    SparseVector v = new SparseVector(-1, indices, values);
    DenseVector dv = v.toDenseVector();
    Assert.assertEquals(dv.size(), 6);
    Assert.assertArrayEquals(dv.getData(), new double[]{0, 1, 0, 3, 0, 5}, TOL);
}