I'm not searching for clean and good looking code.
I'm curious if there is a way to do it with less conversions and function calls
Explaining all passages
public static int Double (double d, int p) {
String dToString = d+"";
char stringToChar = dToString.charAt(p);
String charToString = stringToChar+"";
int stringToInt = Integer.parseInt(charToString);
return stringToInt;
}
Condensed and ugly version
public static int Double (double d, int p) {
return Integer.parseInt(((d+"").charAt(p))+"");
}
}