Added convenience decode function to java impl.