JavaÖеÄBigDecimalµÄʹÓÃ
BigDecimalÀà
Ë«¾«¶È¸¡µãÐͱäÁ¿double¿ÉÒÔ´¦Àí16λÓÐЧÊý¡£ÔÚʵ¼ÊÓ¦ÓÃÖУ¬ÐèÒª¶Ô¸ü´ó»òÕ߸üСµÄÊý½øÐÐÔËËãºÍ´¦Àí¡£JavaÔÚjava.math°üÖÐÌṩµÄAPIÀàBigDecimal£¬ÓÃÀ´¶Ô³¬¹ý16λÓÐЧλµÄÊý½øÐо«È·µÄÔËËã¡£±í5.7ÖÐÁгöÁËBigDecimalÀàµÄÖ÷Òª¹¹ÔìÆ÷ºÍ·½·¨¡£
±í5.7 BigDecimalÀàµÄÖ÷Òª¹¹ÔìÆ÷ºÍ·½·¨
¹¹ÔìÆ÷ÃèÊö
BigDecimal(int)´´½¨Ò»¸ö¾ßÓвÎÊýËùÖ¸¶¨ÕûÊýÖµµÄ¶ÔÏó¡£
BigDecimal(double)´´½¨Ò»¸ö¾ßÓвÎÊýËùÖ¸¶¨Ë«¾«¶ÈÖµµÄ¶ÔÏó¡£
BigDecimal(long)´´½¨Ò»¸ö¾ßÓвÎÊýËùÖ¸¶¨³¤ÕûÊýÖµµÄ¶ÔÏó¡£
BigDecimal(String)´´½¨Ò»¸ö¾ßÓвÎÊýËùÖ¸¶¨ÒÔ×Ö·û´®±íʾµÄÊýÖµµÄ¶ÔÏó¡£
Ðø±í
·½·¨Ãè Êö
add(BigDecimal)BigDecimal¶ÔÏóÖеÄÖµÏà¼Ó£¬È»ºó·µ»ØÕâ¸ö¶ÔÏó¡£
subtract(BigDecimal)BigDecimal¶ÔÏóÖеÄÖµÏà¼õ£¬È»ºó·µ»ØÕâ¸ö¶ÔÏó¡£
multiply(BigDecimal)BigDecimal¶ÔÏóÖеÄÖµÏà³Ë£¬È»ºó·µ»ØÕâ¸ö¶ÔÏó¡£
divide(BigDecimal)BigDecimal¶ÔÏóÖеÄÖµÏà³ý£¬È»ºó·µ»ØÕâ¸ö¶ÔÏó¡£
toString()½«BigDecimal¶ÔÏóµÄÊýֵת»»³É×Ö·û´®¡£
doubleValue()½«BigDecimal¶ÔÏóÖеÄÖµÒÔË«¾«¶ÈÊý·µ»Ø¡£
floatValue()½«BigDecimal¶ÔÏóÖеÄÖµÒÔµ¥¾«¶ÈÊý·µ»Ø¡£
longValue()½«BigDecimal¶ÔÏóÖеÄÖµÒÔ³¤ÕûÊý·µ»Ø¡£
intValue()½«BigDecimal¶ÔÏóÖеÄÖµÒÔÕûÊý·µ»Ø¡£
×¢Ò⣬ÓÉÓÚÒ»°ãÊýÖµÀàÐÍ£¬ÀýÈçdouble£¬²»ÄÜ׼ȷµØ´ú±í16λÓÐЧÊýÒÔÉϵÄÊý×Ö£¬ÔÚʹÓÃBigDecimalʱ£¬Ó¦ÓÃBigDecimal(String)¹¹ÔìÆ÷´´½¨¶ÔÏó²ÅÓÐÒâÒå¡£ÁíÍ⣬BigDecimalËù´´½¨µÄÊǶÔÏó£¬ÎÒÃDz»ÄÜʹÓô«Í³µÄ+¡¢-¡¢*¡¢/µÈËãÊõÔËËã·ûÖ±½Ó¶ÔÆä¶ÔÏó½øÐÐÊýѧÔËË㣬¶ø±ØÐëµ÷ÓÃÆäÏà¶ÔÓ¦µÄ·½·¨¡£·½·¨ÖеIJÎÊýÒ²±ØÐëÊÇBigDecimalµÄ¶ÔÏó¡£
ÏÂÃæÌÖÂÛBigDecimalÀàµÄһЩ³£ÓÃÀý×Ó£º
//ÍêÕû³ÌÐòÀý×ÓÔÚ±¾ÊéÅäÌ××ÊԴĿ¼Ch5ÖÐÃûΪBigDecimalTestApp.java
//´´½¨BigDecimal¶ÔÏó
BigDecimal bigNumber = new BigDecimal("89.1234567890123456789");
BigDecimal bigRate = new BigDecimal(1000);
BigDecimal bigResult = new BigDecimal(); //¶ÔÏóbigResultµÄֵΪ0.0
//¶ÔbigNumberµÄÖµ³ËÒÔ1000£¬½á¹û ¸³ÓèbigResult
bigResult = bigNumber.multiply(bigRate);
System.out.println(bigResult.toString());
//»òÕßSystem.out.println(bigResult);
//ÏÔʾ½á¹û£º89123.4567890123456789000
//ÒÔË«¾«¶ÈÊý·µ»ØbigNumberÖеÄÖµ
double dData = bigNumber.doubleValue();
System.out.println(dData); //½á¹û
Ïà¹ØÎĵµ£º
Õ⼸ÌìÒ»Ö±ÔÚÑо¿FlexÖÐRemoteObjectÓëjavaµÄ½»»¥ÎÊÌ⣬¿ÉÒ»Ö±²»³É¹¦£¬½ñÌìÖÕÓڳɹ¦ÁË£¬µ«ÊÇ»¹ÓÐһЩÒÉ»ó£¬Ó¦¸Ã¼ÌÐøŬÁ¦¡£
ÏÂÃæÊÇÎҵľ¹ýºÍÅöµ½µÄ´íÎó£º
£¨1£©ÏÂÔغͰ²×°lcds.
ÔÚ°²×°Ä¿Â¼Ï»áÓÐÈçÏÂÎļþ£¬ÆäÖÐlcds.war¿ÉÒÔ×÷ΪÎÒÃÇ¿ª·¢FlexÓëjava½»»¥µÄÄ£°æ£¬°ÑÕâ¸öÎļþ¿¼µ½ÄãtomcatµÄwebappsÏ£¨µ±È»ÕâÖÖÇé¿öÊÇÄ ......
JNIÊÇJava Native InterfaceµÄËõд£¬Í¨¹ýʹÓÃnative·½·¨£¬Java¿ÉÒÔµ÷Óñ¾µØC/C++×Ó³ÌÐò¡£ÉùÃ÷Ò»¸ö±¾µØ×Ó³ÌÐòµÄ·½·¨ÊÇ£ºÔÚ·½·¨ÃûÇ°Ìí¼ÓnativeÐÞÊΣ¬Èç
public native void myfun();
µ÷ÓøÃ×Ó³ÌÐòµÄ·½·¨Îª£º
static{
System.loadLibrary("myfun");
}
ÔÚWindowsÉÏ£¬ÉÏÃæµÄmyfun¼´Ö¸°üº¬ÓÃC/C++дµÄmy ......
µÚÒ»£º
1.StringÊÇ×î»ù±¾µÄÊý¾ÝÀàÐÍô£¿
´ð£º²»ÊÇ¡£»ù±¾µÄÊý¾ÝÀàÐÍ°üÀ¨£ºbyte,int,char,long,float,double,booleanºÍshort.
java.lang.StringÀàÊÇfinalÀàÐ͵ģ¬Òò´Ë²»¿ÉÒԼ̳ÐÕâ¸öÀ࣬²»ÄÜÐÞ¸ÄÕâ¸öÀà¡£
2.¾²Ì¬±äÁ¿ºÍʵÀý±äÁ¿µÄÇø±ð£¿
´ð£ºstatic i = 10 ;//³£Á¿
&nb ......
Ò»°ãµÄÊÊÓÃÓÚS40µÄJAVAÈí¼þ¶¼¿ÉÒÔ×°ÔÚŵ»ùÑÇ3110cÉÏ,°üÀ¨ÓÎÏ·,µç×ÓÊé,Ó¦ÓÃÈí¼þ ʲôÊÇJAVAÈí¼þÄØ£¿
JavaÊÇÓÉSun΢ϵͳ¹«Ë¾Ëù·¢Õ¹³öÀ´µÄ³ÌÐòÓïÑÔ£¬Ëü±¾ÉíÊÇÒ»ÖÖ¶ÔÏóµ¼Ïò£¨Object-Oriented£©µÄ³ÌÐòÓïÑÔ¡£JAVAÄ¿Ç°ÔÚÊÖ»úÉÏÓ¦ÓÃ×î¶àµÄ¾ÍÊÇJAVAÓÎÏ·¡£
JavaÒ²ºÅ³ÆÊÇÄÜ¿çƽ̨ʹÓõÄÓïÑÔ£¬ÕâÖ÷ÒªÊÇÒòΪJava±¾Éí±»±àÒëÖ®ºó£¬²¢² ......
package barchartdemo1;
import java.awt.Font;
import java.io.FileOutputStream;
import java.io.IOException;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.Numbe ......