# JAVA高精度加法数组和Biginteger实现

import java.math.BigInteger;
import java.util.Scanner;

import javax.print.attribute.URISyntax;

public class 高精度加法 {
public static void main(String[] args) {
/*
* Scanner read=new Scanner(System.in); BigInteger a,b,c;
* System.out.println(c);
*/   (biginteger 实现)
-----------------------------------------------------------------------------------------------------------------------------------------------              ------------------数组实现             ------------------------------------------------------
char a[], b[];
ta.reverse();
tb.reverse();
int alen = ta.length();
int blen = tb.length();

boolean istalonger = alen > blen ? true : false;
for (int i = 0; i < Math.abs(alen - blen); i++) {
if (istalonger)
tb.append("0");
else
ta.append("0");
}
ta.append("0");
tb.append("0");
a = ta.toString().toCharArray();
b = tb.toString().toCharArray();
int maxl = a.length;
int ia[] = new int[maxl];
int ib[] = new int[maxl];
int result[] = new int[maxl];
for (int i = 0; i < maxl; i++) {
ia[i] = Character.getNumericValue(a[i]);
ib[i] = Character.getNumericValue(b[i]);
}
int temp = 0, s;
for (int i = 0; i < maxl; i++) {
s = ia[i] + ib[i] + temp;
result[i] = s % 10;
temp = s / 10;
}
int k = result.length - 1;
for (; k >= 0; k--) {
if (result[k] != 0)
break;
}
for (int i =k; i >= 0; i--) {
System.out.print(result[i]);
}

}
}


12-19 1251

08-23 2713
05-12 336
09-25 5107
03-23 1090
04-13 3055
12-03 467
06-08 1683
12-21 2267
02-11 2万+
02-26 2万+
04-22 1129