javaת»»»õ±ÒΪÖÐÎÄ
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Arrays;
public class NumberChange
{
private String strNum;
private String strNumChFormat;
private String strNumTemp;
private int intNumLen;
private String strBegin;
public NumberChange(String strNum)
{
this.strNum = strNum;
}
public boolean check(String strNum)
{
boolean valid = false;
if (strNum.substring(0, 1).equals("0"))
{
this.strNum = strNum.substring(1);
}
try
{
new Double(strNum);
valid = true;
}
catch (NumberFormatException ex)
{
System.out.println("Bad number format!");
}
return valid;
}
public void init()
{
strNumChFormat = "";
intNumLen = strNum.length();
strNumTemp = strNum;
strNumTemp = strNumTemp.replace('1', 'Ò»');
strNumTemp = strNumTemp.replace('2', '¶þ');
strNumTemp = strNumTemp.replace('3', 'Èý');
strNumTemp = strNumTemp.replace('4', 'ËÄ');
strNumTemp = strNumTemp.replace('5', 'Îå');
strNumTemp = strNumTemp.replace('6', 'Áù');
strNumTemp = strNumTemp.replace('7', 'Æß');
strNumTemp = strNumTemp.replace('8', '°Ë');
strNumTemp = strNumTemp.replace('9', '¾Å');
strNumTemp = strNumTemp.replace('0', 'Áã');
strNumTemp = strNumTemp.replace('.', 'µã');
strBegin = strNumTemp.substring(0, 1);
}
public String readNum()
{
if (check(strNum))
{
init();
try
{
for (int i = 1, j = 1, k = 1; i < intNumLen; i++)
{
if (strNumTemp.charAt(intNumLen - 1) == 'Áã' && i
Ïà¹ØÎĵµ£º
ÀàÐÍת»» Îı¾¿òStringתΪdouble Double·â×°Àà
Òì³£´¦Àí
ÏÔʾ¸ñʽ
ÕûÊý½á¹ûĩβȥ.0
Ê×λ²»ÄÜΪ0
+/- ÎÊÌâ Êý´óÓÐbug
Á¬¼ÓÁ¬¼õÎÊÌâ
»ØÍË
³ý0±¨´í
²»ÄܳöÏÖ¶à¸öµã °´ÁËÒ»¸öµãÔÙ°´Ã»ÓÐ
×Ö·û´®ÊDz ......
Ï̳߳ØÖ÷ÒªÊÇÓÃÀ´ ´¦Àí¶à¸öÇëÇóʱ£¬¼õÉÙ×ÊÔ´ÏûºÄ£¬Ìá¸ßÓ¦ÓÃÐÔÄÜ¡£
ÏÂÃæµÄ´úÂëÊÇÀ´×ÔÓÚ ËïÎÀÇÙ£º<<JavaÍøÂç±à³Ì¾«½â>> ÖÐÏ̳߳ØʵÏÖÔ´Âë, ´úÂë½á¹¹¼òµ¥ÇåÎú£¬¶ÔÓÚÀí½âÏ̳߳أ¬wait(),notify()·½·¨¶¼ÓÐÓÐºÜ ......
import java.util.Random;
/**
* ÅÅÐò²âÊÔÀà
*
* ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º
* 1.²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©£»
* 2.½»»»ÅÅÐò£¨Ã°ÅÝÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©£»
* 3.Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£©£»
* 4.¹é²¢ÅÅÐò£»
* 5.»ùÊýÅÅÐò¡£
*
& ......
Java ÌṩÁ½ÖÖ²»Í¬µÄÀàÐÍ£ºÒýÓÃÀàÐͺÍÔʼÀàÐÍ£¨»òÄÚÖÃÀàÐÍ£©¡£IntÊÇjavaµÄÔʼÊý¾ÝÀàÐÍ£¬IntegerÊÇjavaΪintÌṩµÄ·â×°Àà¡£JavaΪÿ¸öÔʼÀàÐÍÌṩÁË·â×°Àà¡£
ÔʼÀàÐÍ·â×°Àà
boolean -->Boolean
char --->Character
byte -->Byte
short -->Short
int -->Integer
long -->Long
float -- ......