本文共 580 字,大约阅读时间需要 1 分钟。
//将字符串转化为char数组String str = "abc";char[] array = str.toCharArray();//将char数组转化为字符串char[] chars = { 'a', 'b', 'c', 'd'};String arr = new String(chars);//"abcd"//将数字或者字符进行排序char[] array = { 'c', 'b', 'a'};Arrays.sort(array);array = { 'a', 'b', 'c'};//将集合转化为数组int[] ints = list.stream().mapToInt(Integer::intValue).toArray();//将字符串转化为整型数字Integer.parseInt(String s)//对集合进行排序 升序list.sort((o1, o2)->{ return o1 - o2;});//对数组进行复制 将nums1从第0个开始 复制到temp 也是从第0个开始复制 复制m个System.arraycopy(nums1, 0, temp, 0, m);//把字符变成数字 char s = '1'; int i = s - '0'; System.out.println(i);//1
转载地址:http://klhzi.baihongyu.com/