Reputation: 1491
Using HBase with Java
If we have
Bytes[] a = Bytes.add(Bytes.toBytes(10), Bytes.toBytes(20));
Is there any way of getting the individual numbers back?
Upvotes: 0
Views: 213
Reputation: 10650
byte[] lower = Bytes.toBytes(10);
byte[] upper = Bytes.toBytes(20);
byte[] b = Bytes.add(lower,upper);
//get back
int lowNum = Bytes.toInt(Arrays.copyOfRange(b, 0, lower.length));
int highNum = Bytes.toInt(Arrays.copyOfRange(b, lower.length, b.length));
Upvotes: 1