Convering String to Int array in java -
i have "string line " variable in java when give
system.out.println(line);
it gives me output
233 81 335 332 165 56 82 316 123 247 328 348 177 89 86 1 252 228 34 350 116 91 193 106 272 121 56 203 179 259 25 163 101 77 116 135 29 257 254 400 195 192 20 59 270 350 116 92 6 87 22 230 126 207 393 73 399 57 96 93 9 196 172 111 192 234 315 59 35 351 390 239 88 339 145 17 161 330 328 198 47 194 107 231 312 260 118 369 344 114 355 99 117 199 219 5 255 336 124
the above output 4 separate lines.
now want convert string int array, such every location of integer array hold these numbers. tried tokenizing , parsing it, when info big 200000 lines of record, gives me error.
any suggestions? pls help.
use scanner class pass line (string) scanner
constructor , utilize methods hasnextint()
check , nextint()
fetch , store arraylist<integer>
utilize of loop
.
java string int
No comments:
Post a Comment