BigInteger, BigDecimal,也是Number的派生类,初始化之后不能被改变
BigInteger a = new BigInteger("9223372036854775807"); BigInteger b = new BigInteger("2"); BigInteger c = a.multiply(b); System.out.println(c); BigDecimal a = new BigDecimal(1.0); BigDecimal b = new BigDecimal(3); BigDecimal c = a.divide(b,20,BigDecimal.ROUND_UP);
String类:Strings are immutable
创建的两种方式: String xxx = new String();//存在堆区
String xxx = "";//存在栈区(string pool)
字符和数字转换为String:String.valueOf(xxx);
StringBuffer/StringBuilder: an alternative to String. 比String更灵活,可以修改stringbuffer内的值,相对而言String一旦初始化就不能被修改。
StringBuffer stringbuffer = new StringBuffer(); stringbuffer.append(xxx); stringbuffer.insert(xxx); stringbuffer.delete(xxx); stringbuffer.deleteCharAt(xxx); stringbuffer.replace(xxx); stringbuffer.reverse(); stringbuffer.setCharAt(xxx);
BigInteger, BigDecimal,也是Number的派生类,初始化之后不能被改变
BigInteger a = new BigInteger("9223372036854775807"); BigInteger b = new BigInteger("2"); BigInteger c = a.multiply(b); System.out.println(c); BigDecimal a = new BigDecimal(1.0); BigDecimal b = new BigDecimal(3); BigDecimal c = a.divide(b,20,BigDecimal.ROUND_UP);
String类:Strings are immutable 创建的两种方式: String xxx = new String();//存在堆区 String xxx = "";//存在栈区(string pool) 字符和数字转换为String:String.valueOf(xxx); StringBuffer/StringBuilder: an alternative to String. 比String更灵活,可以修改stringbuffer内的值,相对而言String一旦初始化就不能被修改。
StringBuffer stringbuffer = new StringBuffer(); stringbuffer.append(xxx); stringbuffer.insert(xxx); stringbuffer.delete(xxx); stringbuffer.deleteCharAt(xxx); stringbuffer.replace(xxx); stringbuffer.reverse(); stringbuffer.setCharAt(xxx);
RegularExpressions regex正则表达式: