@Test
 public void testSliceNormal() {
   double[] arr1 = new double[] {2, 3, 4, 5, 6};
   double[] arr2 = new double[] {4, 5, 6};
   double[] arr3 = new double[] {2, 3, 4};
   DoubleVector vec1 = new DenseDoubleVector(arr1);
   assertArrayEquals(arr2, vec1.slice(2, 4).toArray(), 0.000001);
   DoubleVector vec2 = new DenseDoubleVector(arr1);
   assertArrayEquals(arr3, vec2.slice(3).toArray(), 0.000001);
 }
 @Test(expected = IllegalArgumentException.class)
 public void testSliceWithNegativeLength() {
   double[] vals1 = {1, 2, 3, 4, 5, 6, 7, 8};
   DoubleVector vec1 = new DenseDoubleVector(vals1);
   vec1.slice(3, 2);
 }
 @Test(expected = IllegalArgumentException.class)
 public void testSliceWithOutofBounds() {
   double[] vals = {1, 2, 3, 4, 5, 6, 7, 8};
   DoubleVector vec = new DenseDoubleVector(vals);
   vec.slice(1, 9);
 }
 @Test(expected = IllegalArgumentException.class)
 public void testSliceWithNegativeIndices() {
   double[] vals = {1, 2, 3, 4, 5, 6, 7, 8};
   DoubleVector vec = new DenseDoubleVector(vals);
   vec.slice(-1, -9);
 }
 @Test(expected = IllegalArgumentException.class)
 public void testSliceAbnormalStartLargerThanEnd() {
   double[] arr1 = new double[] {2, 3, 4, 5, 6};
   DoubleVector vec = new DenseDoubleVector(arr1);
   vec.slice(4, 3);
 }
 @Test(expected = IllegalArgumentException.class)
 public void testSliceAbnormalEndTooLarge() {
   double[] arr1 = new double[] {2, 3, 4, 5, 6};
   DoubleVector vec = new DenseDoubleVector(arr1);
   vec.slice(2, 5);
 }