class Ideone {
public static void main
(String[] args
) { System.
out.
println(digit
(98765,
2)); }
static int digit(int a, int b) {
while (--b > 0) {
a /= 10;
}
return a % 10;
}
}
Y2xhc3MgSWRlb25lIHsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB7CgkJU3lzdGVtLm91dC5wcmludGxuKGRpZ2l0KDk4NzY1LCAyKSk7Cgl9CgogICAgc3RhdGljIGludCBkaWdpdChpbnQgYSwgaW50IGIpIHsKICAgICAgICB3aGlsZSAoLS1iID4gMCkgewogICAgICAgICAgICBhIC89IDEwOwogICAgICAgIH0KICAgICAgICByZXR1cm4gYSAlIDEwOwogICAgfQp9