### Question:
BTools { public static String getSDbl( double Value, int DecPrec ) { String Result = ""; if ( Double.isNaN( Value ) ) return "NaN"; if ( DecPrec < 0 ) DecPrec = 0; String DFS = "###,###,##0"; if ( DecPrec > 0 ) { int idx = 0; DFS += "."; while ( idx < DecPrec ) { DFS = DFS + "0"; idx ++; if ( idx > 100 ) break; } } DecimalFormatSymbols DcmFrmSmb = new DecimalFormatSymbols( Locale.getDefault()); DcmFrmSmb.setDecimalSeparator('.'); DcmFrmSmb.setGroupingSeparator(' '); DecimalFormat DcmFrm; DcmFrm = new DecimalFormat( DFS, DcmFrmSmb ); Result = DcmFrm.format( Value ); return Result; }  static String getMtLvESS( int mtLv ); static String getMtLvISS(); static String getSpaces( int SpacesCount ); static String getSBln( boolean... blnA ); static String getSDbl( double Value, int DecPrec ); static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign ); static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign, int StringLength ); static String getSInt( int Value, int CharsCount ); static String getSInt( int Value, int CharsCount, char LeadingChar ); static String getSInt( int Value ); static String getSIntA( int... intA ); static int getIndexCharsCount( int MaxIndex ); static String getSLcDtTm(); static String getSLcDtTm( String FormatS );  }### Answer:
@Test public void testgetSDbl() throws Exception { assertEquals( "NaN", BTools.getSDbl( Double.NaN, 0 ) ); assertEquals( "-6", BTools.getSDbl( -5.5D, 0 ) ); assertEquals( "-5.50", BTools.getSDbl( -5.5D, 2 ) ); assertEquals( "-5.30", BTools.getSDbl( -5.3D, 2 ) ); assertEquals( "-5", BTools.getSDbl( -5.3D, 0 ) ); assertEquals( "0.00", BTools.getSDbl( 0D, 2 ) ); assertEquals( "0", BTools.getSDbl( 0D, 0 ) ); assertEquals( "0.30", BTools.getSDbl( 0.3D, 2 ) ); assertEquals( "4.50", BTools.getSDbl( 4.5D, 2 ) ); assertEquals( "4", BTools.getSDbl( 4.5D, 0 ) ); assertEquals( "6", BTools.getSDbl( 5.5D, 0 ) ); assertEquals( "12 345 678", BTools.getSDbl( 12345678D, 0 ) ); assertEquals( "-456", BTools.getSDbl( -456D, 0, false ) ); assertEquals( "-456", BTools.getSDbl( -456D, 0, true ) ); assertEquals( "+456", BTools.getSDbl( 456D, 0, true ) ); assertEquals( "456", BTools.getSDbl( 456D, 0, false ) ); assertEquals( " 0", BTools.getSDbl( 0D, 0, true ) ); assertEquals( "0", BTools.getSDbl( 0D, 0, false ) ); assertEquals( " 4.50", BTools.getSDbl( 4.5D, 2, false, 6 ) ); assertEquals( " +4.50", BTools.getSDbl( 4.5D, 2, true, 6 ) ); assertEquals( " +456", BTools.getSDbl( 456D, 0, true, 7 ) ); assertEquals( " 456", BTools.getSDbl( 456D, 0, false, 7 ) ); }