Tilt sensor written in Java