Here you can find the source of intToScaleString(final int number, final int scale)
Parameter | Description |
---|---|
number | a parameter |
scale | a parameter |
@Deprecated private static String intToScaleString(final int number, final int scale)
//package com.java2s; //License from project: Apache License public class Main { private static final char[] characters = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; /**/*from www .j a v a2 s . c om*/ * int to scale string * * @param number * @param scale * @return String */ @Deprecated private static String intToScaleString(final int number, final int scale) { if (number < 0) { throw new RuntimeException(String.format("unsupport nagative number:%s", number)); } int length = scale <= characters.length ? scale : characters.length; StringBuilder builder = new StringBuilder(); int num = number; do { int mod = num % length; builder.append(characters[mod]); num = (num - mod) / (length); } while (num > 0); return builder.reverse().toString(); } }