# Making human readable representations of an integer. This implies that a number is infinite (i.e. infinite number) and that the values of integer are equal to the number of numbers.

```
String humanReadable(int inputNumber) {
if (inputNumber == -1) {
return "";
}
int remainder;
int quotient;
quotient = inputNumber / 1000000;
remainder = inputNumber % 1000000;
if (quotient > 0) {
return humanReadable(quotient) + " million, " + humanReadable(remainder);
}
quotient = inputNumber / 1000;
remainder = inputNumber % 1000;
if (quotient > 0) {
return humanReadable(quotient) + " thousand, " + humanReadable(remainder);
}
quotient = inputNumber / 100;
remainder = inputNumber % 100;
if (quotient > 0) {
return humanReadable(quotient) + " hundred, " + humanReadable(remainder);
}
quotient = inputNumber / 10;
remainder = inputNumber % 10;
if (remainder == 0) {
//hackish way to flag the algorithm to not output something like "twenty zero"
remainder = -1;
}
if (quotient == 1) {
switch(inputNumber) {
case 10:
return "ten";
case 11:
return "eleven";
case 12:
return "twelve";
case 13:
return "thirteen";
case 14:
return "fourteen";
case 15:
return "fifteen";
case 16:
return "sixteen";
case 17:
return "seventeen";
case 18:
return "eighteen";
case 19:
return "nineteen";
}
}
switch(quotient) {
case 2:
return "twenty " + humanReadable(remainder);
case 3:
return "thirty " + humanReadable(remainder);
case 4:
return "forty " + humanReadable(remainder);
case 5:
return "fifty " + humanReadable(remainder);
case 6:
return "sixty " + humanReadable(remainder);
case 7:
return "seventy " + humanReadable(remainder);
case 8:
return "eighty " + humanReadable(remainder);
case 9:
return "ninety " + humanReadable(remainder);
}
switch(inputNumber) {
case 0:
return "zero";
case 1:
return "one";
case 2:
return "two";
case 3:
return "three";
case 4:
return "four";
case 5:
return "five";
case 6:
return "six";
case 7:
return "seven";
case 8:
return "eight";
case 9:
return "nine";
}
}
```

Source: By ninesided as answer to the question

This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 2.5

##### Related code-snippets:

- How can I get the value of in a loop?
- Function for creating color wheels.
- What is the most efficient code for 10000 prime numbers?
- How can we efficiently get sorted sums of a sorted list?
- "Sorting" colors by distinctiveness. Followup:
- What is the best way to calculate Big O?
- Graph serialization is a form of graph serialization.
- Find largest rectangle in cubic cm (middle rectangle problem)!
- Looking for algorithm that reverses the sprintf() function output?
- How do I design a calendar like Google calendar?
- How can I tell if variable has numeric value in Perl?
- How can I optimize search algorithms in C language?
- What are some effective ways to compare float and double comparisons?
- Is there a way to separate game logic from display?
- What's the best word wrap algorithm?