java ´óÊýÀà
import java.io.*;
class BigInt
{
int a[];
int len;
BigInt(String str)
{
{
len=str.length();
a=new int[len];
for(int i=0;i<len;i++)
{
this.a[i]=str.charAt(i)-48;
}
}
}
public BigInt bigplus(BigInt b)
{
BigInt sum;
int l;
int m=len-1;
int n=b.len-1;
int max;
if(len>=b.len)
{
l=b.len;
max=len-1;
sum=this;
}
else
{
l=len;
sum=b;
max=b.len-1;
}
for(int i=0;i<l;i++)
{
sum.a[max]=a[m]+b.a[n];
if(max!=0&&sum.a[max]>=10)
{
sum.a[max]=sum.a[max]-10;
sum.a[max-1]++;
}
m--;
n--;
max--;
}
return sum;
}
public void output()
{
for(int i=0;i<len;i++)
{
System.out.print(a[i]);
}
}
}
class TestBig
{
public static void main(String[] args) throws IOException
{
String str1;
String str2;
System.out.println("ÇëÊäÈë´óÊý1:");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
str1=br.readLine();
System.out.println("ÇëÊäÈë´óÊý2:");
BufferedReader br1=new BufferedReader(new InputStreamReader(System.in));
str2=br1.readLine();
BigInt a1=new BigInt(str1);
BigInt a2=new BigInt(str2);
BigInt a3=a1.bigplus(a2);
a3.output();
}
}
Ïà¹ØÎĵµ£º
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import com.paic.is.dispatch.TMPEntry;
import javapassword ......
public class StringUtil
{
public static String convertToStringWithTrim(Object object)
{
if(null == object)
{
return null;
}
String returnStr = (String)object;
return Trim(returnStr);
}
public static String Trim(String str)
{
if(IsEmpty(str))
{
r ......
¹¤ÓûÉÆÆäÊ£¬±ØÏÈÀûÆäÆ÷¡£ÊìϤ¿ª·¢»·¾³¿ÉÒÔÈÃÄã¸ü¿ì¸üºÃ¸üÊæ·þµØ¿ª·¢Èí¼þ¡£¾ÍÈçͬVC/.net¿ª·¢ÈËÔ±Àë²»¿ªmsdn£¬java¿ª·¢ÈËÔ±ÍùÍùÒ²Àë²»¿ªjava API¡£ÏÂÃæ½éÉÜÏÂÈçºÎÔÚEclipseºÍNetBeansÖе¼Èëjava API¡£Ê¹Ö®¿ÉÒÔ·½±ã¿ìËٵزéÕÒ£¬¶¨Î»¡£
¡¡¡¡±¾ÎÄÊʺÏÓë¸Õ¸Õ½Ó´¥Eclipse»òNetBeansµÄjava¿ª·¢ÈËÔ±£¬»òÕßÊÇÓоÑéµÄʹÓÃEc ......
1. Java Ô´ÎļþÖÐ×î¶àÖ»ÄÜÓÐÒ»¸öpublicÀà,¶øÇÒÕâ¸öÀàµÄÀàÃûÒªºÍÎļþÃûÒ»ÖÂ.ÆäËûÀàµÄ¸öÊý²»ÏÞ¡£
2. ÃæÏò¶ÔÏó³ÌÐòÉè¼ÆµÄÌØÕ÷£¨·â×°ÐÔ£©£¨¼Ì³Ð£©£¨¶à̬ÐÔ£©
3. ½Ó¿ÚÊÇÓÉ£¨³éÏó·½·¨£©ºÍ£¨³£Á¿£©×é³ÉµÄÌØÊâÀà
4. ÓÃstaticÐÞÊεķ½·¨Ê ......
ѧϰJava³ÌÐòÖ÷Òª°üº¬ÒÔÏÂËĸö²¿·Ö¡£
(1)±à¼´úÂë edit code
(2)±£´æ´úÂë save code
(3)±àÒë´úÂë compiler code
(4)ÔËÐгÌÐò run program
µÚÒ»¸ö³ÌÐòÎļþHelloWorld.java
public class HelloWorld {
public static void main(String[] args){
......