Java Integer to String intToString(int val, int width)

Here you can find the source of intToString(int val, int width)

Description

int To String

License

Open Source License

Declaration

public static String intToString(int val, int width) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    static String mSpaces = "                                ";

    public static String intToString(int val, int width) {
        String str = new String("" + val);
        if (str.length() >= width) {
            return str;
        }//www.  j a v  a 2s. c  om
        return mSpaces.substring(0, width - str.length()) + str;
    }
}

Related

  1. intToString(int i)
  2. intToString(int i)
  3. intToString(int integer)
  4. intToString(int n)
  5. intToString(int theValue, int nDigits)
  6. intToString(int value)
  7. IntToString(int value)
  8. intToString(int value, int nChars)
  9. intToString(int[] array)