I would like to convert an integer array of values, which was original were bytes.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First, make sure you know in which format your
int[]is meant to be interpreted.Each int can be seen as consisting of four bytes, and these bytes together can be converted to an BigInteger. The details are the byte order – which byte is the most and which one the least significant?
Also, do you have a signed or unsigned number?
A simple way to convert your
ints tobytes (for latter use in a BigInteger constructor) would be to useByteBufferand wrap an IntBuffer around it.Obvious adaptions would be to set the byte order of
bbuf, or use another BigInteger constructor (for unsigned).