I am new to java programming. My question is this I have a String array but when I want to use the contents in a calculation I keep getting the error:
Type mismatch: cannot convert from String to int
My code is:
    public void process(String data) {
        int i, x, length,avg;
        String[] parts = data.split("\r");
        for (i = 0; i < data.length(); i++) {
            x = parts[i];
            avg = avg+x;
            length = length + i;
        }
        averageRate = avg / (length+1);
    }
 
     
    