Java Long Number Format formatLong(long value)

Here you can find the source of formatLong(long value)

Description

Formats a long value and prepends it with a - or + This functions is used for showing the diff values for test runs

License

Open Source License

Parameter

Parameter Description
value - long value

Declaration

public static String formatLong(long value) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from www . j av  a  2  s  .  com
     * Formats a long value and prepends it with a - or +
     * This functions is used for showing the diff values for test runs
     * @param value - long value
     * @return
     */
    public static String formatLong(long value) {
        if (value == 0) {
            return "0";
        } else if (value < 0) {
            return Long.toString(value);
        } else { // if (a < b)
            return "+" + Long.toString(value);
        }
    }
}

Related

  1. format(long value)
  2. formatLong(long inLong, int inLen, boolean inComma, int inCommaPos)
  3. formatLong(Long number)
  4. formatLong(long val, int size)
  5. formatLong(long value)
  6. formatLong(long value, int length)
  7. formatLong(String value)
  8. formatLongAsDecimal(long l)
  9. longToSimpleString(long value)