java - Making an array of ints from a String using charAt(i) gives me 2 digit numbers in each index? -


list s contains values 0000 5555. trying iterate through list , @ each index, charat(0), charat(1), charat(2) , charat(3) , put simple array of ints. how i'm trying achieve this:

for (int = 0; < s.size(); i++) {             (int j = 0; j < width; j++)                 currentguess[j] = integer.valueof(s.get(i).charat(j)); 

however, if use arrays.tostring(currentguess) result [48, 48, 48, 48] first iteration, , goes there, [48, 48, 48, 49] until [53, 53, 53, 53]. happening here?

48 ascii value of character '0'. if want convert digits respective numbers, need use (for example)

integer.valueof(s.get(i).charat(j) - '0'); 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -