-1

Possible Duplicate:
How to convert number to words in java

I am trying to set the long value in the textfield the modification of my code is as below error what it is showing is required long found int

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

            jTextField1.setText(numberToWord(jml));

        }
    }
Community
  • 1
  • 1
Sumeet Gavhale
  • 800
  • 4
  • 13
  • 39

2 Answers2

0

The NumberFormatException is Thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format. So, the exception could be because the maximum value of a java int is 2,147,483,647 (which is a 10-digit integer).

Swapnil
  • 8,201
  • 4
  • 38
  • 57
0

The error is occuring in the below line, And looks like you are using Integer.parseInt() method in the below line,

at myproj.Certificates.jTextField2MouseClicked(Certificates.java:268)

When the value that is being passed to the method Integer.parseInt() is greater than Integer.MAX_VALUE (2,147,483,647), you will receive the java.lang.NumberFormatException.

And since 10000000000 is greater than 2,147,483,647 you are getting the NumberFormatException.

Jayamohan
  • 12,734
  • 2
  • 27
  • 41