Java Long Number Format formatLongAsDecimal(long l)

Here you can find the source of formatLongAsDecimal(long l)

Description

format Long As Decimal

License

Artistic License

Declaration

public static String formatLongAsDecimal(long l) 

Method Source Code

//package com.java2s;
//License from project: Artistic License 

public class Main {
    public static String formatLongAsDecimal(long l) {
        String rv = l + "";
        if (rv.length() < 3) {
            while (rv.length() < 3) {
                rv = "0" + rv;
            }/*from   ww  w.  ja v a 2  s . c  o  m*/

            return "." + rv;
        }

        return rv.substring(0, rv.length() - 3) + "." + rv.substring(rv.length() - 3, rv.length());
    }
}

Related

  1. formatLong(long val, int size)
  2. formatLong(long value)
  3. formatLong(long value)
  4. formatLong(long value, int length)
  5. formatLong(String value)
  6. longToSimpleString(long value)