DoubleOperations implements MathOperations<Double>, Comparator<Double> { @Override public Double roundUp( Double value, int decimalShift ) { if (value == 0) return 0.0d; double shiftedValue = (Math.abs(value) * Math.pow(10.0d, decimalShift) + 0.5d) * Math.signum(value); double roundedValue = (int)shiftedValue; return roundedValue * Math.pow(10.0d, -decimalShift); }  @Override Class<Double> getOperandClass(); @Override Double add( Double value1,
                       Double value2 ); @Override Double subtract( Double value1,
                            Double value2 ); @Override Double multiply( Double value1,
                            Double value2 ); @Override double divide( Double value1,
                          Double value2 ); @Override Double negate( Double value ); @Override Double increment( Double value ); @Override Double maximum( Double value1,
                           Double value2 ); @Override Double minimum( Double value1,
                           Double value2 ); @Override int compare( Double value1,
                        Double value2 ); @Override BigDecimal asBigDecimal( Double value ); @Override Double fromBigDecimal( BigDecimal value ); @Override Double createZeroValue(); @Override Double create( int value ); @Override Double create( long value ); @Override Double create( double value ); @Override double sqrt( Double value ); @Override Comparator<Double> getComparator(); @Override Double random( Double minimum,
                          Double maximum,
                          Random rng ); @Override double doubleValue( Double value ); @Override float floatValue( Double value ); @Override int intValue( Double value ); @Override long longValue( Double value ); @Override short shortValue( Double value ); @Override int getExponentInScientificNotation( Double value ); @Override Double roundUp( Double value,
                           int decimalShift ); @Override Double roundDown( Double value,
                             int decimalShift ); @Override Double keepSignificantFigures( Double value,
                                          int numSigFigs );  }
@Test public void shouldRoundNumbersGreaterThan10() { assertEquals(101.0d, ops.roundUp(101.2523d, 0), 0.01d); assertEquals(101.0d, ops.roundUp(101.2323d, 0), 0.01d); assertEquals(101.3d, ops.roundUp(101.2523d, 1), 0.01d); assertEquals(101.2d, ops.roundUp(101.2323d, 1), 0.01d); assertEquals(110.0d, ops.roundUp(109.2323d, -1), 1d); assertEquals(100.0d, ops.roundUp(101.2323d, -1), 1d); }