0
What is '10' doing there?
int num = 5542; String number = String.valueOf(num); for(int i = 0; i < number.length(); i++) { int j = Character.digit(number.charAt(i), 10); System.out.println("digit: " + j); } Asking about the 10 in line 4. I guess it's converting char into int..but am no sure!
2 ответов
+ 1
I think it's used to convert it to particular number system => 10 is for decimal, 2 is for binary number etc.
0
Yea, 10 is converting 'j' in base 10 i.e equal to j but in an integer form.
Got it, thanks anyways
TheWh¡teCat