Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. public static void main(String[] args) throws IOException {
  2. String[][] users = CSVReader("./users.csv");
  3. //String[][] items = CSVReader("./items.csv");
  4. }
  5.  
  6. public static String[][] CSVReader(String fileName) throws FileNotFoundException, IOException
  7. {
  8.  
  9. String[][] mainData = new String[20][2];
  10.  
  11. File file = new File(fileName);
  12.  
  13. BufferedReader br = new BufferedReader(new FileReader(file));
  14.  
  15. String st;
  16. int counter = 0;
  17. while ((st = br.readLine()) != null) {
  18. String[] data = st.split(",");
  19. mainData[counter] = data;
  20. counter++;
  21. }
  22.  
  23. return mainData;
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement