Java Integer to String intToStr(int value, int len)

Here you can find the source of intToStr(int value, int len)

Description

int To Str

License

Apache License

Declaration

public static String intToStr(int value, int len) 

Method Source Code

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

public class Main {
    public static String intToStr(int value, int len) {
        String result = String.valueOf(value);
        if (result.length() > len) {
            result = String.copyValueOf(result.toCharArray(), 0, len);
        }//from www. j  ava2  s .  c o m
        int count = len - result.length();
        for (int i = 0; i < count; i++) {
            result = "0" + result;
        }
        return result;
    }
}

Related

  1. intToStr(int nValue)
  2. intToStr(int priceInt)
  3. intToStr(int val)
  4. intToStr(int valor, int len)
  5. intToStr(int value)
  6. inttostr(String intStr)
  7. intToStr3(final int param)
  8. intToString(final int param)
  9. intToString(final int value)