### Question:
PspUtils { public static String formatWithSignificantDigits(double number, int significantDigits) { BigDecimal bdNumber = new BigDecimal(number); BigDecimal bdRounded = bdNumber.round(new MathContext(significantDigits)); double rounded = bdRounded.doubleValue(); DecimalFormat df = new DecimalFormat("0"); df.setMaximumFractionDigits(340); return df.format(rounded); }  static String getThreadId(); static String getIdString(final long n); static void setupNewThread(); static Map<String, Object> getStemAttributes(Group group); static Map<String, Object> getGroupAttributes(Group group); static Map<String, Object> getGroupAttributes(PITGroup pitGroup); static String getFirstRdnString(final String dnAttributeValue); static String formatWithSignificantDigits(double number, int significantDigits); static Object formatDate_DateHoursMinutes(DateTime asofDate, String ifNull); static Set<String> getStringSet(boolean caseSensitive); static Set<String> getStringSet(boolean caseSensitive, Collection<String> values ); static Set<String> subtractStringCollections(boolean caseSensitiveValues, Collection<String> c1, Collection<String> c2); static Set<String> intersectStringCollections(boolean caseSensitiveValues, Collection<String> c1, Collection<String> c2); static final String THREAD_ID_MDC; }### Answer:
@Test public void formatWithSignificantDigits() { assertEquals("1.2", PspUtils.formatWithSignificantDigits(1.23314, 2)); assertEquals("1.2", PspUtils.formatWithSignificantDigits(1.1532, 2)); assertEquals("120", PspUtils.formatWithSignificantDigits(123.314, 2)); assertEquals("0.0012", PspUtils.formatWithSignificantDigits(0.00123314, 2)); }