Use this sample code:
public class Bargraph
{
//start method
public static void main (String args[])throws IOException
{
//defining all my variables I will use
int spaceNeed = 0;
int spaceHave = 0;
String newLine = "";
String line = "";
int firstIndex = 0;
int done = 0;
double barHeight = 0;
int canvasHeight = 400;
int maxPossible = 19000000;
int currentStatePop = 0;
int left = 0;
//rand method define
Random rand = new Random();
//Reads in the file and creates the scanner




    File theData = new File("stateInfo (1).txt");
    Scanner dataReader = new Scanner(theData);
    //gets user input and makes sure its "men" or "women"
    String userInput = SimpleIO.getString("Which do you prefer? women or men");
    //loop till men or women is answered
    while (!(userInput.equals("men") || userInput.equals("women"))){
        userInput = SimpleIO.getString("Which do you prefer? women or men");
        userInput = userInput.toLowerCase();
    }
    //goes to 3rd collumn if men
    if (userInput.equals("men")){
        spaceNeed = 3;
    }
    //if women goes to 4th collumn
    else{
        spaceNeed = 4;
    }
    //define canvas
    MyroCanvas canvas = new MyroCanvas("canvas", 800, 400);
    //skip first row
    dataReader.nextLine();
    //reads each line
    while(dataReader.hasNext()){
        line = (dataReader.nextLine());
        //itterates through collumns
        for (int i = 0; i < line.length(); i++){
            if (line.substring(i,i+1).equals(" ")){
                spaceHave += 1;
            }
            if (spaceHave == spaceNeed){
                if (done == 0){
                    firstIndex = i;
                    done = 1;
                }
            }
                if (spaceHave == (spaceNeed + 1)){
                    if (done == 1){
                        //gets the targeted collumn
                        newLine = line.substring(firstIndex + 1,i);
                        done = 2;
                    }
                }
                //skips if the targeted collumn and row string has no number in it
                if (newLine.equals("")){
                    continue;
                }
                
                
            }
            //converts string to integer
            currentStatePop = Integer.parseInt(newLine);
            
                //defines bar height
                barHeight = canvasHeight * ((double) currentStatePop / maxPossible);
                //makes bar
                MyroRectangle rectangle = new MyroRectangle(canvas, left, 400 - (int)barHeight, 16, (int) barHeight);
                rectangle.visible();
                left += 16;
                Color rColor = new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255));
                rectangle.setFillColor(rColor);
                rectangle.makeFilled();
        spaceHave = 0;
        done = 0;
        }
        
    }
}
to graph 4 year and 2 year program applicants to admissions with respect to ACT and SAT scores with this csv file:
Nonprofit,For-profit,
4-year,2-year,4-year,2-year

Number of applications (in thousands),4,444,16,76,18

90 percent or more accepted,2.3,9.0,10.1,29.1
75.0 to 89.9 percent accepted,14.2,10.3,8.3,31.1
50.0 to 74.9 percent accepted,37.6,26.0,68.7,27.1
25.0 to 49.9 percent accepted,25.6,54.8,12.8,12.6
10.0 to 24.9 percent accepted,12.9,0.0,,0.0
Less than 10 percent accepted,7.4,0.0,0.0,0.0

Number of enrollees (in thousands),486,3,17,7
90 percent or more accepted,5.1,10.9,22.9,36.1
75.0 to 89.9 percent accepted,19.5,18.1,14.3,30.9
50.0 to 74.9 percent accepted,43.8,52.6,48.8,25.6
25.0 to 49.9 percent accepted,20.3,18.4,13.9,7.4
10.0 to 24.9 percent accepted,8.1,0.0,,0.0
Less than 10 percent accepted,3.2,0.0,0.0,0.0
SAT scores of enrollees,,,,
"Critical reading, 75th percentile",585,526,550,
"Mathematics, 75th percentile",587,536,553,
ACT scores of enrollees,
"Composite, 75th percentile",25.9,23.2,24.1,
"English, 75th percentile",26.3,21.8,23.6,
"Mathematics, 75th percentile",25.5,20.4,24.0,