开发中经常用到Arrays和Collections这两个工具类. 在数组和列表之间进行切换.非常方便.但是也会遇到一些问题. 看代码: import java.util.Arrays; import java.util.List; public class Client { public static void main(String[] args) { int[] data = {1,2,3,4,5}; List list = Arrays.asList(data); System.out.p…
1.数组转换list (1) List myList = new ArrayList(); String[] myStringArray = new String[] {"Java", "is", "Cool"}; Collections.addAll(myList, myStringArray); (2) String[] words = { ... }; List<String> list = new ArrayList<S…
import org.apache.commons.lang.ArrayUtils; import java.nio.charset.Charset; /** * 字节数组转换工具类 */ public class BytesUtils { public static final String GBK = "GBK"; public static final String UTF8 = "utf-8"; public static final char[] asci…