Intermediate values Java<->JS conversion issues