lets say i have a string object...this string object holds 3 separate "future" int data types...which i can easily "tokenize" and then convert to an int for a variable to hold.
ex. "25 5 500"
question is...how can i access say the int of 500 from this string object in one statement so I am able to compare it to another int variable?
String line = "25 5 500"; new String(line); //string object created st = new StringTokenizer(line, " "); while(st.hasMoreTokens()){ String arr = st.nextToken(); String p = st.nextToken(); String cpu = st.nextToken(); int arrival = Integer.parseInt(arr.trim()); int pid = Integer.parseInt(p.trim()); int cputime = Integer.parseInt(cpu.trim()); }
arrival = 25
pid = 5
cputime = 500