added java conversion and read data loop