[英]Invalid results from HBase Bytes.toString(byte[] b) in Jython
[英]What is the difference between Bytes.toString(bytes) and bytes.toString()?
我有一个由字节数组表示的整数。
byte[] result = getResult();
resultInt1 = Integer.parseInt(Bytes.toString(result));//1
resultInt2 = Integer.parseInt(result.toString());//2
第一种方法一切正常,但是第二种方法捕获NumberFormatException。
这两种方法有什么区别?
数组不会覆盖toString()
。
因此, bytes.toString()
不会返回任何有意义的东西。 相反,它将返回类似[B@18c28a
。 ( [B
是byte
数组的内部表示形式)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.