Java Integer Format formatInteger(int integer, int length)

Here you can find the source of formatInteger(int integer, int length)

Description

format Integer

License

LGPL

Declaration

public static String formatInteger(int integer, int length) 

Method Source Code

//package com.java2s;
/*//w  ww  .  jav  a2s .c o m
 * Copyright 2008  Egon Willighagen <egonw@users.sf.net>
 * 
 * License: LGPL v3
 */

public class Main {
    public static String formatInteger(int integer, int length) {
        String curInt = ("" + integer);
        while (curInt.length() < length) {
            curInt = " " + curInt;
        }
        return curInt;
    }
}

Related

  1. formatIntAsDottedOctet(int value)
  2. formatIntAsIpAddress(final int address)
  3. formatInteger(byte[] btValue, int iOffset, int iLength)
  4. formatInteger(int i, int j)
  5. formatInteger(int inInt, int inLen, boolean inComma, int inCommaPos)
  6. formatInteger(int value, int length)
  7. formatInteger(Integer value)
  8. formatIntegerBase2WithLeadingZeros(long x, int length)
  9. formatIntegerWithLeadingZeros(long x, int radix, int length)