@ Trivial public static String toAbsSec ( long nano , int padLeft ) { if ( nano < 0 ) { return "-" + toAbsSec ( - 1 * nano , padLeft ) ; } else if ( nano == 0 ) { return PAD . substring ( 0 , padLeft ) + "." + PAD . substring ( PAD_RIGHT ) ; } String nanoText = Long . toString ( nano ) ; int nanoDigits = nanoText . length ( ) ; if ( nanoDigits > NANO_IN_ONE_DIGITS ) { // greater than 999,999,999 int secDigits = nanoDigits - NANO_IN_ONE_DIGITS ; if ( secDigits >= padLeft ) { return nanoText . substring ( 0 , secDigits ) + "." + nanoText . substring ( secDigits , secDigits + PAD_RIGHT ) ; } else { int padDigits = padLeft - secDigits ; if ( padDigits > PAD_LEN ) { padDigits = PAD_LEN ; } return PAD . substring ( 0 , padDigits ) + nanoText . substring ( 0 , secDigits ) + "." + nanoText . substring ( secDigits , secDigits + PAD_RIGHT ) ; } } else if ( nanoDigits > ( NANO_IN_ONE_DIGITS - PAD_RIGHT ) ) { // less than 1,000,000,000 and greater than 999 if ( padLeft > PAD_LEN ) { padLeft = PAD_LEN ; } int missingDigits = NANO_IN_ONE_DIGITS - nanoDigits ; return PAD . substring ( 0 , padLeft ) + "." + PAD . substring ( 0 , missingDigits ) + nanoText . substring ( 0 , PAD_RIGHT - missingDigits ) ; } else { // less than 1,000, but greater than 0. if ( padLeft > PAD_LEN ) { padLeft = PAD_LEN ; } return PAD . substring ( 0 , padLeft ) + "." + PAD . substring ( PAD_RIGHT - 1 ) + "*" ; } }
Display a nano - seconds value as a decimal seconds value .