类型互转
1.各种类型转String
2.String转Bytes
3.数组转List
4.进制转换
5.
parse 在 SimpleDateFormat 中是转换为Date类,其它的一些包装类都是转换为int/double等基本类
valueOf 转换的是类 eg: Integer /Double/Float....
import java.lang.reflect.Constructor;import java.lang.reflect.InvocationTargetException;import java.util.Arrays;import java.util.HashMap;import java.util.List;import java.util.Map;import java.util.Map.Entry;import java.util.Scanner;public class Main { public static void main(String[] args) throws Exception { Integer a = 12; Integer [] aaa = new Integer[10]; for(int i = 0;i<10;i++) aaa[i] = new Integer(i);//对象数组要一个一个new System.out.println(Arrays.toString(aaa));//自己主动拆包 数组转String System.out.println(Integer.toBinaryString(a));//String System.out.println(Integer.toHexString(a));//String String t = "23"; byte [] b = t.getBytes(); Integer aa = Integer.parseInt(t, 10); System.out.println(aa); List list = Arrays.asList(aaa); System.out.println(list); aaa = (Integer [])list.toArray(new Integer[0]); System.out.println(Arrays.toString(aaa)); }}/* * [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] *1100 *c *23 *[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] *[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] */class Child extends Main { }