write function to get data from Java