本帖最后由 陈圳 于 2013-3-11 15:01 编辑
关于数组的工具类Arrays里面有三个deep前缀的方法,其中deepToString()方法是为了多维数组转化为字符串设计的.
我测试了一下其方法:
public static void main(String[] args)
{
nt[][][] arr4={{{12},{34},{43},{14},{34},{41}},{{34},{21},{67},{98},{32},{85}}};
Integer[][][] arr3={{{12},{34},{43},{14},{34},{41}},{{34},{21},{67},{98},{32},{85}}};
System.out.println(Arrays.toString(arr3));
System.out.println(Arrays.deeptoString(arr3));
System.out.println(Arrays.toString(arr4));
System.out.println(Arrays.deeptoString(arr4));
}
打印结果:
[[[Ljava.lang.Integer;@de6ced, [[Ljava.lang.Integer;@c17164]
[[[12], [34], [43], [14], [34], [41]], [[34], [21], [67], [98], [32], [85]]]
[[[I@60aeb0, [[I@16caf43]
[[[12], [34], [43], [14], [34], [41]], [[34], [21], [67], [98], [32], [85]]]
如果是一维数组我们都明白那是 对象+@哈希值,三维数组似乎也应该是三个.
对于这个deepToString深度转换字符串.实在有些想不明白.看下大家有什么经验. |