converting currency to words with long values
<p>i tried again to solve the errors but unable to get in correct output i m trying to insert long integer values from textfield but then string builder is making problem i guess. Its very problematic m not able to take a proper correction decision where to correct. First 3 if statements are executing without error the problem is with rest of if statements.</p>

<pre><code> public static String numberToWord(final long num) { 
    // special case to simplify later on 
    if (num == 0) { 
    return "zero"; 
    } 

    // constant number names for each category 

    // single digits 
    final String n_1_9[] = new String[]{"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; 
    // unfortunate special cases for ten, eleven, twelve, and teens 
    final String n_10_19[] = new String[]{"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"}; 
    // tens 
    final String n_20_90[] = new String[]{"", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"}; 
    final String n_100 = "hundred"; 
    final String n_1000 = "thousand"; 
    final String n_100000 = "lakh";
    final String n_10000000 = "crore"; 

    // use StringBuilder for efficient modifications 
    StringBuilder numWord = new StringBuilder(); 

    long n = num; 

    // append with selective recursion for all our cases 


    if (n &gt;= 10000000) { 
    numWord.append(numberToWord(n / 10000000)); 
    numWord.append(' '); 
    numWord.append(n_10000000); 
    numWord.append(' '); 
    n %= 10000000; 
    } 

    if (n &gt;= 100000) { 
    numWord.append(numberToWord(n / 100000)); 
    numWord.append(' '); 
    numWord.append(n_100000); 
    numWord.append(' '); 
    n %= 100000; 
    } 

    if (n &gt;= 1000) { 
    numWord.append(numberToWord(n / 1000)); 
    numWord.append(' '); 
    numWord.append(n_1000); 
    numWord.append(' '); 
    n %= 1000; 
    } 
    if (n &gt;= 100) { 
    numWord.append(n_1_9[n / 100]); 
    numWord.append(' '); 
    numWord.append(n_100); 
    numWord.append(' '); 
    n %= 100; 

    } 
    if (n &gt;= 20) { 
    numWord.append(n_20_90[(n / 10) - 1]); 
    numWord.append(' '); 
    n %= 10; 
    } 
    if (n &gt;= 10) { 
    numWord.append(n_10_19[n - 10]); 
    } 
    if (n &lt; 10) { 
    numWord.append(n_1_9[n]); 
    } 

    return numWord.toString().trim(); 
    }
        private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {

        }

        private void jTextField2MouseClicked(java.awt.event.MouseEvent evt) {
            if(evt.getSource()==jTextField2){
                long jml = Long.parseLong(jTextField3.getText());
                jTextField1.setText(numberToWord(jml));

            }
        }
</code></pre>
