added java code that returns id