How to Download CSV to file using Java

My program is to take in a URL that has a CSV file. I’m trying to pass the this into a file for further querying, but it returns with a NoSuchElementException.

public static void main(String[] args) throws ParseException, IOException, URISyntaxException {
    // TODO Auto-generated method stub

    String web = "https://example.com/data.csv";
    URL content = new URL(web);

    File file = new File(content.getPath());

    try {
        Scanner inputStream = new Scanner(file);    //Input file
        String[] values = data.split(",");
   while (inputStream.hasNext()){

            data = inputStream.next();

            values = data.split(",");
            System.out.println(values[];
  }
inputStream.close();
} catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}