Imagine you have a binary or hexadecimal representation of a number. Take this:
int number = 0xffffff;
int third_f = byteSubstring(number,2,1);
int tf = byteSubstring(number,2,2);
int except_first = byteSubstring(number,1,5);
Using separate bitwise operations, pen and paper, I know how to extract them all, but combining them into one common function ... :). Is there something already in the JDK that can do this for numeric types?
source
share