1

I am building an app which utilizes the Parse back-end. As part of my user object I want to directly use the FacebookID as my UserID, but I want to convert it to a BigInt instead of a string.

I used the following code, but when I check the data in Parse the value is slightly off.

"user" is a GraphUser object which I have declared above.

String iDString = user.getId();
BigInteger iD = new BigInteger(iDString);
currentUser.put("faceID", iD);

When I check the data in Parse I get the following:

Original ID in string format (* are used to cover digits):

************27645

BigInt ID:

************27644

Does anyone know why the last digit is 1 less than the digit above? May it have something to with the sign of the BigInt?

icLutcha
  • 13
  • 2
  • Hard to tell without actual values but [this](http://stackoverflow.com/questions/12693273/is-there-an-upper-bound-to-biginteger) might help. – Mena Jul 01 '14 at 15:56

1 Answers1

1

I don't know which is your problem due to the lack of information in your post.

This simple case works very well for me though:

String iDString = "99999999999997645";
BigInteger iD = new BigInteger(iDString);
System.out.println(iD.toString());

The printed number is exactly the same of the iDString "number".

luiscosta
  • 855
  • 1
  • 10
  • 16
  • You're right, I just tested it client side and the values are completely the same. When it is being saved to Parse the value is changing. That is so strange. – icLutcha Jul 01 '14 at 20:47