Java: change to use startsWith to avoid RTE error

proposed fix for #43