Код: Выделить всё
String tmp = "12345";
int result = 0;
for (int i =0; i < tmp.length(); i++){
char digit = (char)(tmp.charAt(i) - '0');
result += (digit * Math.pow(10, (tmp.length() - i - 1)));
}
System.out.println(result);
Код: Выделить всё
char digit = (char)(tmp.charAt(i) - '0');
Подробнее здесь: https://stackoverflow.com/questions/803 ... ing-charat
Мобильная версия