共回答了20个问题采纳率:85%
import java.util.*;
class AddBigNumber{
public static StringBuffer Mul(StringBuffer s1,StringBuffer s2){
StringBuffer sb=new StringBuffer();
for(int i=0;i=0;i--){
for(int j=s2.length()-1;j>=0;j--){
int m=(int)(s1.charAt(i)-'0')*(int)(s2.charAt(j)-'0');
int n=i+j+1;
int x=(int)(sb.charAt(n)-'0');
x=x+m;
char c=String.valueOf(x%10).charAt(0);
sb.setCharAt(n,c);
while(x>=10){
m=x/10;
n--;
x=(int)(sb.charAt(n)-'0');
x=x+m;
c=String.valueOf(x%10).charAt(0);
sb.setCharAt(n,c);
}
}
}
return sb;
}
public static void main(String[] args){
StringBuffer sb=new StringBuffer("1");
StringBuffer s;
for(int i=1;i
1年前
1