Processing commands that interact with sensors in Java