# 整数转换英文表示

<p>将非负整数 <code>num</code> 转换为其对应的英文表示。</p>

<p> </p>

<p><strong>示例 1：</strong></p>

<pre>
<strong>输入：</strong>num = 123
<strong>输出：</strong>"One Hundred Twenty Three"
</pre>

<p><strong>示例 2：</strong></p>

<pre>
<strong>输入：</strong>num = 12345
<strong>输出：</strong>"Twelve Thousand Three Hundred Forty Five"
</pre>

<p><strong>示例 3：</strong></p>

<pre>
<strong>输入：</strong>num = 1234567
<strong>输出：</strong>"One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven"
</pre>

<p><strong>示例 4：</strong></p>

<pre>
<strong>输入：</strong>num = 1234567891
<strong>输出：</strong>"One Billion Two Hundred Thirty Four Million Five Hundred Sixty Seven Thousand Eight Hundred Ninety One"
</pre>

<p> </p>

<p><strong>提示：</strong></p>

<ul>
	<li><code>0 <= num <= 2<sup>31</sup> - 1</code></li>
</ul>


## template

```java
class Solution {

	String[] withinTwentyNum = new String[] { "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight",
			"Nine", "Ten",
			"Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" };

	String[] theWholeTen = new String[] { "", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty",
			"Ninety" };

	String[] unit = new String[] { "", "Thousand", "Million", "Billion" };

	public String numberToWords(int num) {
		if (num == 0) {
			return withinTwentyNum[num];
		}
		StringBuilder sb = new StringBuilder();
		int unitCount = 0;
		int temp;

		String[] words = new String[32];
		int wordIndex = 0;

		for (int n = num; num > 0; unitCount++) {

			n = num % 1000;
			num /= 1000;
			if (n == 0) {
				continue;
			}

			words[wordIndex++] = unit[unitCount];
			temp = n % 100;
			if (n % 100 > 0) {

				if (temp >= 20) {
					if (temp % 10 > 0) {

						words[wordIndex++] = withinTwentyNum[temp % 10];
					}

					words[wordIndex++] = theWholeTen[temp / 10];

				} else {

					words[wordIndex++] = withinTwentyNum[temp];
				}
			}
			temp = n / 100;
			if (temp > 0) {

				words[wordIndex++] = "Hundred";
				words[wordIndex++] = withinTwentyNum[temp];
			}
		}

		for (int index = wordIndex - 1; index >= 0; index--) {
			sb.append(words[index]).append(" ");
		}

		return sb.toString().trim();
	}
}


```

## 答案

```java

```

## 选项

### A

```java

```

### B

```java

```

### C

```java

```