long a = 1; long b = 2; List<Long> list = Arrays.asList(a,b);
先將List<Long>集合轉爲Long[]數組java
Long[] L = list.stream().toArray(Long[]::new)
再將Long[]數組轉爲long[]數組。使用的是org.apache.commons.lang包中的一個工具類ArrayUtils.javaapache
long[] l = ArrayUtils.toPrimitive(L)
long[]數組轉爲字符串。不能直接用toString(),這裏toString()返回的是數組存儲的地址。使用以下方式數組
String s = Arrays.toString(l)