Is it the Java you need help with or the maths?

// Json