1、BigDecimal使用
字符串实例化:BigDecimal f1=new BigDecimal("0.01");
浮点数实例化要采用静态方法: BigDecimal f2=BigDecimal.valueof("0.02");
2、日期使用
Calendar calendar=Calendar.getInstance();
Date now=calendar.getTime();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String dateString=simpleDateFormat.format(now); //format
Date date=simpleDateFormat.parse(dateString); //parse
long time=System.currentTimeMillis();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
System.out.println(format.format(time));
3、运行时
Runtime runtime=Runtime.getRuntime();
System.out.println("可用内存:"+runtime.freeMemory());
System.out.println("获取JVM试图使用的最大内存:"+runtime.maxMemory());
System.out.println("获取JVM只能使用的最大内存:"+runtime.totalMemory());
//..........................
Process notepad=runtime.exec("notepad");
Thread.sleep(3000);
notepad.destroy(); //关闭进程
4、集合基本用法
List<string> s = new ArrayList<string>();
LinkedList<String> list=new LinkedList<String>();
Set<Person> persons=new HashSet<Person>();
HashMap<Integer,String> hashMap=new HashMap<Integer,String>();
5、泛型
class Arrays<T>{
public <E>void test(E[] array){ return; }
public <E>void test(E[] array){ return; }