DoublesScheduleGenerator { public static double[] leftTruncate(final double lower, final double[] set) { final int n = set.length; if (n == 0) { return set; } if (lower < set[0]) { return set; } if (lower >= set[n - 1]) { return new double[0]; } final int index = Arrays.binarySearch(set, lower); final int chop = index >= 0 ? index + 1 : -(index + 1); double[] res; if (chop == 0) { res = set; } else { res = new double[n - chop]; System.arraycopy(set, chop, res, 0, n - chop); } return res; }  static double[] getIntegrationsPoints(final double start, final double end, final ISDACompliantYieldCurve yieldCurve, final ISDACompliantCreditCurve creditCurve); static double[] getIntegrationsPoints(final double start, final double end, final double[] setA, final double[] setB); static double[] combineSets(final double[] set1, final double[] set2); static double[] truncateSetInclusive(final double lower, final double upper, final double[] set); static double[] truncateSetExclusive(final double lower, final double upper, final double[] set); static double[] leftTruncate(final double lower, final double[] set);  }
@Test public void leftTruncateTest() { final double lower = 0.2; final double[] set0 = new double[] {0.1, 0.3, 0.5 }; final double[] exp0 = new double[] {0.3, 0.5 }; final double[] res0 = DoublesScheduleGenerator.leftTruncate(lower, set0); assertTrue(equalArrays(exp0, res0)); final double[] set1 = new double[] {0.1, 0.15 }; final double[] exp1 = new double[] {}; final double[] res1 = DoublesScheduleGenerator.leftTruncate(lower, set1); assertTrue(equalArrays(exp1, res1)); final double[] set2 = new double[] {0.25, 0.3, 0.5 }; final double[] exp2 = new double[] {0.25, 0.3, 0.5 }; final double[] res2 = DoublesScheduleGenerator.leftTruncate(lower, set2); assertTrue(equalArrays(exp2, res2)); final double[] set3 = new double[] {}; final double[] exp3 = new double[] {}; final double[] res3 = DoublesScheduleGenerator.leftTruncate(lower, set3); assertTrue(equalArrays(exp3, res3)); final double[] set4 = new double[] {0.0, 0.3, 0.5 }; final double[] exp4 = new double[] {0.0, 0.3, 0.5 }; final double[] res4 = DoublesScheduleGenerator.leftTruncate(-0.0, set4); assertTrue(equalArrays(exp4, res4)); }