Java code for river monitor.