Youngjae Youngjae - 10 months ago 49
Java Question

org.json.JSONObject.getLong gives imprecise result

Wrong precision in Long conversion

In android, as we can see attached figure,
the json that I received from server is "id=-705156352446547*2446*"
but the code

gives -705156352446547*2512*.

I can see every
conversion has imprecise result(or lose precision?) in last 4 digits.
Is there anything that I missed?

My settings: java 1.6.0_41, Android 4.1.2, IntelliJ 12 IDE.

Answer Source

Long.parseLong(jsonObject.getString("id")) gives precise result.