Updated java code to later version that supports android!