Java Integer Format formatIntOrLong(long v)

Here you can find the source of formatIntOrLong(long v)

Description

format Int Or Long

License

Open Source License

Declaration

static String formatIntOrLong(long v) 

Method Source Code

//package com.java2s;
/*/*from   ww  w.j a v  a  2 s. c  o m*/
 *      Copyright (C) 2015  higherfrequencytrading.com
 *
 *      This program is free software: you can redistribute it and/or modify
 *      it under the terms of the GNU Lesser General Public License as published by
 *      the Free Software Foundation, either version 3 of the License.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU Lesser General Public License for more details.
 *
 *      You should have received a copy of the GNU Lesser General Public License
 *      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    static String formatIntOrLong(long v) {
        if (v >= Integer.MIN_VALUE && v <= Integer.MAX_VALUE)
            return v + "";
        return v + "L";
    }
}

Related

  1. formatIntegerWithLeadingZeros(long x, int radix, int length)
  2. formatIntents(String[] intents)
  3. formatInterval(long interval)
  4. formatIntoHHMMSS(int secsIn)
  5. formatIntoHHMMSS(long l)
  6. formatInts(int[] vals)
  7. formatIntWithPadding(int value, int length, char pad)