Looking at the other questions on this task, I feel like I've gone the completely wrong route.
Not sure why though
package com.codegym.task.task18.task1807;
import java.io.*;
/*
Counting commas
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String fileName = reader.readLine();
FileInputStream fileInputStream = new FileInputStream(fileName);
if (fileInputStream.available() > 0) {
byte[] buffer = new byte[fileInputStream.available()];
int count = 0;
for (int i = 0; i< buffer.length; i++){
if (buffer[i]==44)
count++;
}
System.out.println(count);
}
fileInputStream.close();
}
}