class Bignumber {
private String data;
private int length;
Bignumber (String str)
{

data = str;
length = str.length();
}

Bignumber add (Bignumber str)
{
String temp=""; 
int max_length=( this.length > str.length ) ? this.length : str.length ;
int min_lenrth=( this.length < str.length ) ? this.length : str.length ;
for (int i=0;i<max_length-min_lenrth;i++)
temp+="0";
if(this.data.length() == max_length)
{
str.data = str.data + temp;
}
else
{
this.data = this.data + temp;
}

for(int j = max_length-1; j>=0; j--)
{
int jw = 0, tempnum = 0;
String tempString = "";
int a = Integer.parseInt(String.valueOf(this.data.charAt(j)));
int b = Integer.parseInt(String.valueOf(str.data.charAt(j)));
if ( a + b + jw >= 10 && j != 0)
{
tempnum = a + b + jw - 10 ;
jw = 1;
}
else
{
tempnum = a + b + jw ;
jw = 0 ;
}
tempString = String.valueOf(tempnum) + tempString ;
this.data = tempString ;
System.out.println (tempString.toString());
}

return this ;
}
void display ()
{
System.out.println(this.data.toString());
   
}
}class BignumberTest{
public static void main (String [] args)
{
   Bignumber b1 = new Bignumber ("123456789");
   Bignumber b2 = new Bignumber ("123456789");
   b1.add(b2);
   b1.display();
 }

}错误提示:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 7
at java.lang.String.charAt(Unknown Source)
at Bignumber.add(bigNumber.java:36)
at BignumberTest.main(bigNumber.java:69)