public class MatrixMultiply{
    public static void main(String[] args) {
        main();
    }
    static void main() {
        int[] vec = { 1, 2, 3, 4, 5 };
        System.out.println( mean( vec ) );
    }
    static int mean(int[] v) {
        int total = 0;
        for (int i = 0 ; i < v.length ; i++ ) {
            total = total + v[i];
        }
        return total / v.length;
    }
}
The above works but i don't want to say "int[] vec = { 1, 2, 3, 4, 5 };" I want to create something like:
String w = "1 2 3 4 5";
and then work out the mean of w. How would i be able to get to w and do this?