采用POI操作excel API:http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFCell.html poi包:http://pan.baidu.com/s/1hmIQU 一.读取excel内容 1.excel内容的值如果不是string,则用getNumericCellValue(),得到double类型,再做相应转换,如果为string,则用getStringCellValue() public static S
我们经常要将数字进行格式化,比如取2位小数,这是最常见的.Java 提供DecimalFormat类,帮你用最快的速度将数字格式化为你需要的样子.下面是一个例子: import java.text.DecimalFormat; public class TestNumberFormat{ public static void main(String[]args){ double pi = 3.1415927; //圆周率 //取一位整数 System.out.println(new Decima