### Question:
DoubleUtils { static boolean hasPrecision(final double value, final int decimals) { final double scaled=value*scale(decimals); return Double.doubleToRawLongBits(scaled-(long)scaled)==0; } private  DoubleUtils();   }### Answer:
@Test public void rejectsValuesWithMoreDigitsThanSpecified() throws Exception { assertThat(DoubleUtils.hasPrecision(0.1234,3),equalTo(false)); }
@Test public void acceptsValuesWithLessDigitsThanSpecified() throws Exception { assertThat(DoubleUtils.hasPrecision(0.12345678,9),equalTo(true)); }
@Test public void acceptsValuesWithTheSameDigitsThanSpecified() throws Exception { assertThat(DoubleUtils.hasPrecision(0.12345,5),equalTo(true)); }