Java 将数字转换为单词
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26977523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Converting number to word
提问by sleepy
I would like to get some help on converting an integer to word. I am very new to Java, i kind of have an idea of what i think im going to be doing but need some help with it.
我想在将整数转换为单词方面获得一些帮助。我对 Java 很陌生,我有点知道我想我要做什么,但需要一些帮助。
The code should print the words of number from 0-999 and once -1 typed in the scanner the program should stop.
代码应该打印 0-999 之间的数字,一旦在扫描仪中输入 -1,程序就会停止。
Like this:
像这样:
Please type a number between 0 and 999: 1
ONE
Please type a number between 0 and 999: 11
ELEVEN
Please type a number between 0 and 999: 122
ONE HUNDRED AND TWENTY TWO
Please type a number between 0 and 999: 1000
NUMBER OUT OF RANGE
Please type a number between 0 and 999: -1
Thank you for using our program
请输入 0 到 999 之间的数字:1
一
请输入 0 到 999 之间的数字:11
十一
请输入 0 到 999 之间的数字:122
一百二十二
请输入 0 到 999 之间的数字:1000
号码超出范围
请输入 0 到 999 之间的数字:-1
感谢您使用我们的程序
I also have to use methods to make this "Cleaner"
我还必须使用方法来制作这个“清洁器”
采纳答案by kriyeta
First of all take hundreds place digit by deviding by 100 and print corresponding number by calling method numberToWord((number / 100), " HUNDRED");
since number / 100would be in between 0 to 9 so it will print digit in word concatenated by HUNDRED.
首先通过除以100取百位数字并通过调用方法打印相应的数字, numberToWord((number / 100), " HUNDRED");
因为number / 100将在0到9之间,因此它将打印由HUNDRED连接的单词中的数字。
Now you left with two digit number for that you directly call numberToWord((number % 100), " ");
since we are taking modulo 100 of number so it would pass two digit only. if (num > 19) {System.out.print(tens[num / 10] + " " + ones[num % 10]);}
then it will take tens place and print tens word concatenated by ones. else {System.out.print(ones[num]);}
directly prints word between 1 to 19 from the array.
现在您留下了两位数的号码,您可以直接拨打该号码,numberToWord((number % 100), " ");
因为我们正在对号码取模 100,因此它只能通过两位数。if (num > 19) {System.out.print(tens[num / 10] + " " + ones[num % 10]);}
然后它将占据十位并打印由十位连接的十个单词。else {System.out.print(ones[num]);}
直接从数组中打印 1 到 19 之间的单词。
import java.util.Scanner;
public class Test1 {
public static void main(String[] args) {
int number = 0;
Scanner scanner = new Scanner(System.in);
System.out.print("Please type a number between 0 and 999 OR type -1 to exit: ");
number = scanner.nextInt();
while(number!=-1){
if(number>=0 && number<=999){
if(number==0){
System.out.print("NUMBER AFTER CONVERSION:\tZERO");
} else {
System.out.print("NUMBER AFTER CONVERSION:\t");
numberToWord(((number / 100) % 10), " HUNDRED");
numberToWord((number % 100), " ");
}
} else{
System.out.print("NUMBER OUT OF RANGE");
}
System.out.print("\nPlease type a number between 0 and 999 OR type -1 to exit: ");
number = scanner.nextInt();
}
}
public static void numberToWord(int num, String val) {
String ones[] = {" ", " ONE", " TWO", " THREE", " FOUR", " FIVE", " SIX", " SEVEN", " EIGHT", " NINE", " TEN", " ELEVEN", " TWELVE", " THIRTEEN", " FOURTEEN", " FIFTEEN", " SIXTEEN", " SEVENTEEN", " EIGHTEEN", " NINETEEN"
};
String tens[] = {" ", " ", " TWENTY", " THIRTY", " FOURTY", " FIFTY", " SIXTY", " SEVENTY", " EIGHTY", " NINETY"};
if (num > 19) {
System.out.print(tens[num / 10] + " " + ones[num % 10]);
} else {
System.out.print(ones[num]);
}
if (num > 0) {
System.out.print(val);
}
}
}
Sample output:
示例输出:
Please type a number between 0 and 999 OR type -1 to exit: 563
NUMBER AFTER CONVERSION: FIVE HUNDRED SIXTY THREE
Please type a number between 0 and 999 OR type -1 to exit: 45
NUMBER AFTER CONVERSION: FOURTY FIVE
Please type a number between 0 and 999 OR type -1 to exit: 6
NUMBER AFTER CONVERSION: SIX
Please type a number between 0 and 999 OR type -1 to exit: 0
NUMBER AFTER CONVERSION: ZERO
Please type a number between 0 and 999 OR type -1 to exit: -1
exit
回答by Rohit Jain
This is recursive solution of Number to Word program
这是 Number to Word 程序的递归解决方案
string unitsMap[] = { "zero", "one", "two", "three", "four", "five","six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
string tensMap[] = { "zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };
string NumberToWords(int number)
{
if (number == 0)
return "zero";
if (number < 0)
return "minus " + NumberToWords(abs(number));
string words = "";
if ((number / 1000000000) > 0)
{
words += NumberToWords(number / 1000000000) + " billion ";
number %= 1000000000;
}
if ((number / 1000000) > 0)
{
words += NumberToWords(number / 1000000) + " million ";
number %= 1000000;
}
if ((number / 1000) > 0)
{
words += NumberToWords(number / 1000) + " thousand ";
number %= 1000;
}
if ((number / 100) > 0)
{
words += NumberToWords(number / 100) + " hundred ";
number %= 100;
}
if (number > 0)
{
if (number < 20)
words += unitsMap[number];
else
{
words += tensMap[number / 10];
if ((number % 10) > 0)
words += "-" + unitsMap[number % 10];
}
}
return words;
}
回答by J.Khan
Here is how you do it. I made it from 1 to 10 but you can expand it from 1 to 999.
这是你如何做到的。我把它从 1 扩大到 10,但你可以把它从 1 扩大到 999。
// values entered | result
// 2 | You have entered:Two
// 10 | You have entered: Ten
// 23 | You have entered: 23 which is not in range.
int i = Integer.parseInt(txtInput.getText());
String[] namesOfNums = {"One", "Two", "Three","Four", "Five", "Six", "Seven","Eight", "Nine","Ten" };
String output = "";
if (i > 0 && i <=10)
{
output = namesOfNums[i - 1];
lblDisplay.setText("You have entered: "+ output);
}
else
{
lblDisplay.setText("You have entered: "+ i +" which is not range.");
}
回答by Kona Suresh
public class NumberToWord
{
private static final String[] specialNames = {
"",
" thousand",
" million",
" billion",
" trillion",
" quadrillion",
" quintillion"
};
private static final String[] tensNames = {
"",
" ten",
" twenty",
" thirty",
" forty",
" fifty",
" sixty",
" seventy",
" eighty",
" ninety"
};
private static final String[] numNames = {
"",
" one",
" two",
" three",
" four",
" five",
" six",
" seven",
" eight",
" nine",
" ten",
" eleven",
" twelve",
" thirteen",
" fourteen",
" fifteen",
" sixteen",
" seventeen",
" eighteen",
" nineteen"
};
private String convertLessThanOneThousand(int number) {
String current;
if (number % 100 < 20){
current = numNames[number % 100];
number /= 100;
}
else {
current = numNames[number % 10];
number /= 10;
current = tensNames[number % 10] + current;
number /= 10;
}
if (number == 0) return current;
return numNames[number] + " hundred" + current;
}
public String convert(int number) {
if (number == 0) { return "zero"; }
String prefix = "";
if (number < 0) {
number = -number;
prefix = "negative";
}
String current = "";
int place = 0;
do {
int n = number % 1000;
if (n != 0){
String s = convertLessThanOneThousand(n);
current = s + specialNames[place] + current;
}
place++;
number /= 1000;
} while (number > 0);
return (prefix + current).trim();
}
public static void main(String[] args) {
NumberToWord obj = new NumberToWord();
System.out.println("*** " + obj.convert(123456789));
System.out.println("*** " + obj.convert(-55));
}
}
来源:http: //javahungry.blogspot.com/2014/05/convert-math-number-to-equivalent-readable-word-in-java-code-with-example.html
回答by Rathina Moorthy Nataraj
import java.util.Scanner;
class Name
{
static String string;
static String st1[]={"","one","two","three","four","five","six","seven","eight","nine"};
static String st2[]={"hundred","thousand","lakh","crore"};
static String st3[]={"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
static String st4[]={"twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninety"};
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
System.out.println("ENTER THE NUMBER");
System.out.println(mac(in.nextInt())+" only");
}
public static String mac(int n)
{
int word;
int nu=1;
string="";
while(n!=0)
{
switch(nu)
{
case 1:
word=n%100;
pass(word);
if(n>100&&n%100!=0)
{
show("and ");
}
n=n/100;
break;
case 2:
word=n%10;
if(word!=0)
{
show(" ");
show(st2[0]);
show(" ");
pass(word);
}
n=n/10;
break;
case 3:
word=n%100;
if(word!=0)
{
show(" ");
show(st2[1]);
show(" ");
pass(word);
}
n=n/100;
break;
case 4:
word=n%100;
if(word!=0)
{
show(" ");
show(st2[2]);
show(" ");
pass(word);
}
n=n/100;
break;
case 5:
word=n%100;
if(word!=0)
{
show(" ");
show(st2[3]);
show(" ");
pass(word);
}
n=n/100;
break;
}
nu++;
}
return string;
}
public static void pass(int n)
{
int word,q;
if(n<10)
{
show(st1[n]);
}
if(n>9&&n<20)
{
show(st3[n-10]);
}
if(n>19)
{
word=n%10;
if(word==0)
{
q=n/10;
show(st4[q-2]);
}
else
{
q=n/10;
show(st1[word]);
show(" ");
show(st4[q-2]);
}
}
}
public static void show(String s)
{
String st=string;
string=s+st;
}
}
回答by Akshay Chopra
import java.util.Scanner;
public class number to words {
static String string;
static String st1[]={"","one","two","three","four","five","six","seven","eight","nine"};
static String st2[]={"hundred","thousand","lakh","crore"};
static String st3[]={"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
static String st4[]={"twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninety"};
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
System.out.println("ENTER THE NUMBER");
System.out.println(mac(in.nextInt())+" only");
}
public static String mac(int n)
{
int word;
int nu=1;
string="";
while(n!=0)
{
switch(nu)
{
case 1:
word=n%100;
pass(word);
if(n>100&&n%100!=0)
{
show("and ");
}
n=n/100;
break;
case 2:
word=n%10;
if(word!=0)
{
show(" ");
show(st2[0]);
show(" ");
pass(word);
}
n=n/10;
break;
case 3:
word=n%100;
if(word!=0)
{
show(" ");
show(st2[1]);
show(" ");
pass(word);
}
n=n/100;
break;
case 4:
word=n%100;
if(word!=0)
{
show(" ");
show(st2[2]);
show(" ");
pass(word);
}
n=n/100;
break;
case 5:
word=n%100;
if(word!=0)
{
show(" ");
show(st2[3]);
show(" ");
pass(word);
}
n=n/100;
break;
}
nu++;
}
return string;
}
public static void pass(int n)
{
int word,q;
if(n<10)
{
show(st1[n]);
}
if(n>9&&n<20)
{
show(st3[n-10]);
}
if(n>19)
{
word=n%10;
if(word==0)
{
q=n/10;
show(st4[q-2]);
}
else
{
q=n/10;
show(st1[word]);
show(" ");
show(st4[q-2]);
}
}
}
public static void show(String s)
{
String st=string;
string=s+st;
}
}
回答by shivi2207
try this for a single digit:
试试这个单数:
public class WordToNumber {
static String string;
static String st1[] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
static int st2[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
public static int mac(String n) {
int digit = 0;
try {
if(Arrays.asList(st1).contains(n.toLowerCase())){
int a = Arrays.asList(st1).indexOf(n.toLowerCase());
digit = st2[a];
}
else{
return -1;
}
} catch (Exception e) {
e.printStackTrace();
return -1;
}
return digit;
}
}
}
回答by pushpendra yadav
//This code can print number to word from 0 to Crore
//这段代码可以打印从0到Crore的数字到单词
public class NumericToWords {
公共类 NumericToWords {
static Map<Long, String> map1 = new HashMap<Long, String>();
public static void main(String[] args) {
Long num = new Long(300001);
print(num, num.toString().length());
}
private static void print(Long num, int length) {
if (length == 0) {
System.out.println("Enter correct number");
} else if (length == 1 || num <= 9) {
printOneDigit(num);
} else if (length == 2 || num <= 99) {
printTwoDigit(num);
} else if (length == 3 || num <= 999) {
printThreeDigit(num);
} else if (length == 4 || num <= 9999) {
printFourDigit(num);
} else if (length == 5 && num <= 99999) {
printFiveDigit(num);
} else if (length == 6 || num <= 999999) {
printSixDigit(num);
} else if (length == 7 || num <= 9999999) {
printSevenDigit(num);
} else if (length == 7 || num <= 99999999) {
printEightDigit(num);
} else
System.out.println("Number is not valid....!!!!!");
}
private static void printOneDigit(Long num) {
System.out.print(map1.get(num) != null ? map1.get(num) : "" + " ");
}
private static void printTwoDigit(Long num) {
if (num % 10 == 0)
System.out.print(map1.get(num) + "");
else if (num < 20) {
System.out.print(map1.get(num) + " ");
} else {
System.out.print(map1.get(num - num % 10) != null ? map1.get(num - num % 10) : "");
System.out.print(" ");
printOneDigit(num % 10);
}
}
private static void printThreeDigit(Long num) {
if (num % 10 == 0 && num % 100 == 0)
System.out.print(map1.get(num / 100) + " HUNDRED");
else {
System.out.print(map1.get(num / 100) + " HUNDRED ");
print(num % 100, 2);
}
}
private static void printFourDigit(Long num) {
if (num % 10 == 0 && num % 100 == 0 && num % 1000 == 0)
System.out.print(map1.get(num / 1000) + " THOUSAND ");
else {
System.out.print(map1.get(num / 1000) + " THOUSAND ");
print(num % 1000, 3);
}
}
private static void printFiveDigit(Long num) {
if (num / 1000 > 0) {
printTwoDigit(num / 1000);
System.out.print(" THOUSAND ");
}
if ((num % 1000) > 99) {
printThreeDigit(num % 1000);
} else if ((num % 1000) > 9) {
printTwoDigit(num % 100);
} else if (num % 10 > 0) {
printOneDigit(num % 10);
}
}
private static void printSixDigit(Long num) {
if (num / 100000 > 0) {
printOneDigit(num / 100000);
System.out.print(" LACK ");
}
if (num > 0)
printFiveDigit(num % 100000);
}
private static void printSevenDigit(Long num) {
if (num / 100000 > 0) {
printTwoDigit(num / 100000);
System.out.print(" LACK ");
}
if (num % 100000 > 9999) {
printFiveDigit(num % 100000);
} else if ((num % 10000) > 999) {
printFourDigit(num % 10000);
} else if ((num % 1000) > 99) {
printThreeDigit(num % 1000);
} else if ((num % 1000) > 9) {
printTwoDigit(num % 100);
} else if (num % 10 > 0) {
printOneDigit(num % 10);
}
}
private static void printEightDigit(Long num) {
printOneDigit(num / 10000000);
System.out.print(" CRORE ");
if (num > 0)
printSevenDigit(num % 10000000);
}
static {
map1.put(0L, "");
map1.put(1L, "ONE");
map1.put(2L, "TWO");
map1.put(3L, "THREE");
map1.put(4L, "FOUR");
map1.put(5L, "FIVE");
map1.put(6L, "SIX");
map1.put(7L, "SEVEN");
map1.put(8L, "EIGHT");
map1.put(9L, "NINE");
map1.put(10L, "TEN");
map1.put(11L, "ELEVEN");
map1.put(12L, "TWELVE");
map1.put(13L, "THIRTEEN");
map1.put(14L, "FOURTEEN");
map1.put(15L, "FIFTEEN");
map1.put(16L, "SIXTEEN");
map1.put(17L, "SEVENTEEN");
map1.put(18L, "EIGHTEEN");
map1.put(19L, "NINTEEN");
map1.put(20L, "TWINITY");
map1.put(30L, "THIRTY");
map1.put(40L, "FOURTY");
map1.put(50L, "FIFTY");
map1.put(60L, "SIXTY");
map1.put(70L, "SEVENTY");
map1.put(80L, "EIGHTY");
map1.put(90L, "NINTY");
}
}
}
回答by DHARMRAJSINGH
This the solution for up to 66 digit number and can be modified according to different-different counting system. For understanding of this counting system please refer https://ptdeepali.wordpress.com/2013/10/28/vedic-numbering-system/.
这是最多66位数字的解决方案,可以根据不同的不同计数系统进行修改。要了解此计数系统,请参阅https://ptdeepali.wordpress.com/2013/10/28/vedic-numbering-system/。
package com.number_to_word;
import java.util.Scanner;
/**
* This program is to get the word value of given number.
* <p>Number can be ranges from 0 to 66th power of 10 (66 digits).</p>
* Number can be passed through Scanner and it will print the word value of that number.
*
* @author DHARAMRAJSINGH
*
*/
public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("enter number: ");
String n = sc.nextLine();
System.out.println(getWord(n));
sc.close();
}
/**
* This method is using array inside it and this array is 2D array contains word values.
* <p>This array ranges from arr[0][0] to arr[9][9]. </p>
* <p>The array is initialized in a way that it will return values like, for arr[0][0] returns zero
* </br> arr[0][1] returns one, arr[2][1] returns twenty one, arr[9][5] returns ninety five, and so on. </p>
* The logic is the number <strong>n</strong> is passed into it and divided by 10, the quotient will be index0 and remainder will be index1,
* and return arr[index0][index1].
* </br>
* @param n will be in the range of 0 to 99
* @return the word value ranges from 0 to 99
*/
private static String getValue(int n) {
int index0 = 0, index1 = 0;
if(n < 0 || n > 99) {
throw new IllegalArgumentException("number cannot be less than zero or greater than 99");
}
if(n < 10) {
index1 = n;
} else {
index1 = n%10;
index0 = n/10;
}
String arr [][] = {
// for "zero", "one" .... "nine"
{"?????", "???", "????", "?????", "???????", "????", "???", "????", "????", "??"},
// for "ten", "eleven" .... "nineteen"
{"??", "???????", "????????", "?????????", "?????????", "????????", "??????", "????????", "?????????", "??????"},
// for "twenty", "twenty one" .... "twenty nine"
{"??????", "?????????", "??????????", "???????????", "???????????", "??????????", "?????????", "??????????", "???????????", "????????"},
// for "thirty", "twenty one" .... "thirty nine"
{"????????", "??????????", "????????????", "????????????", "?????????????", "????????????", "???????????", "????????????", "?????????????", "???????????????"},
{"???????????", "?????????????", "???????????????", "???????????????", "????????????????", "???????????????", "??????????????", "???????????????", "???????????????", "????????????"},
{"????????", "??????????", "????????????", "????????????", "????????????", "????????????", "???????????", "????????????", "????????????","??????????"},
{"??????", "????????", "??????????", "??????????", "??????????", "??????????", "?????????", "??????????", "??????????", "???????????"},
{"???????", "?????????", "???????????", "???????????", "???????????", "???????????", "??????????", "???????????","???????????","??????????"},
{"??????", "????????", "????????", "??????????", "?????????", "??????????", "???????", "??????????", "??????????","?????????"},
// for "ninety", "two" .... "ninety nine"
{"?????", "???????", "?????????", "?????????", "??????????", "?????????", "????????", "?????????", "?????????","????????"}
};
return arr[index0][index1];
}
/**
* This method returns the place value of the digit, like for index value 2 it will return hundred,
* for index value 3 and 4 it will thousand, for index value 5 and 6 it will lacs, and so on.
* <p>It return empty string for index 0 and 1 as it does not have specific name for that.
* @param n is index value of digit
* @return place value of index (position like unit place, tens place etc.)
*/
private static String getPlaceValue(int n) {
String [] arr = {"", "", "??", "???????", "???????", "????", "????", // this line is same as "", "", "hundred", "thousand", "thousand", "lac", "lac"
"????", "????", "????", "????", "????", // same as "crore" , "crore" , "crore" and so on
"?????", "?????", "?????", "?????", "?????",
"????????", "????????", "????????", "????????", "????????",
"?????", "?????", "?????", "?????", "?????",
"????????", "????????", "????????", "????????", "????????",
"????", "????", "????", "????", "????",
"???????", "???????", "???????", "???????", "???????",
"????", "????", "????", "????", "????",
"???????", "???????", "???????", "???????", "???????",
"??????", "??????", "??????", "??????", "??????",
"??", "??", "??", "??", "??",
"????", "????", "????", "????", "????"
};
if(n >= arr.length) {
throw new IllegalArgumentException("Not in range");
} else {
return arr[n];
}
}
/**
* This method takes index(position of digit) as the input and return the number of digits need to be taken in consideration of calculation.
* <p> Like for index 0 only one digit will be passed to get it's word value, for index 1 two digits(00 to 99) need to be passed,
* for index 2 inly one need to be passed and so on.
* @param index position of digit
* @return next index value
*/
private static int numOfDigitsToInclude(int index) {
int [] a = {1, 2, 1, 1, 2, 1, 2,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5};
return a[index];
}
/**
* This method returns next index value for calculations need to be performed.
* @param index
* @return
*/
private static int nextIndex ( int index) {
int [] a = {-1, -1, 1, 2, 2, 4, 4, 6, 6, 6, 6, 6, 11, 11, 11, 11, 11,
16, 16, 16, 16, 16,
21, 21, 21, 21, 21,
26, 26, 26, 26, 26,
31, 31, 31, 31, 31,
36, 36, 36, 36, 36,
41, 41, 41, 41, 41,
46, 46, 46, 46, 46,
51, 51, 51, 51, 51,
56, 56, 56, 56, 56,
61, 61, 61, 61, 61
};
return a[index];
}
/**
* This method takes number as input in String(as it exceeds the limit for long) form.
* <p> Convert into array and loop over it to get word value for number.
* @param num
* @return
*/
private static String getWord(String num) {
if(num.length() == 0) {
throw new IllegalArgumentException("Not valid");
}
if(num.equals("0")){
return getValue(0);
}
String s = "" + num;
int size = s.length();
long [] a = new long [size];
String n = num; int k=0;
for(int j = num.length() -1 ; j >= 0; j--) {
a[k++] = Integer.parseInt(""+ num.charAt(j) );
}
int i = a.length-1;
int arg = 0;
int include = 0;
StringBuffer buffer = new StringBuffer();
while(i >= 0) {
arg = 0;
include = numOfDigitsToInclude(i);
if(include == 2) {
arg = (int) ((int) 10*a[i] + a[i-1]);
} else if(include == 1) {
arg = (int) a[i];
} else {
for(int l = 1; l<=include; l++) {
arg = (int) (10*arg + a[i+1-l]);
}
//recursion used for arg value more than 99
buffer.append(getWord(""+ arg)).append(" ");
}
if(arg == 0) {
i = nextIndex(i);
if(i <= 0) {
continue;
}
continue;
}
if(include <= 2) {
buffer.append(getValue(arg)).append( " ");
}
buffer.append(getPlaceValue(i)).append(" ");
i = nextIndex(i);
}
return buffer.toString();
}
}