class Ideone {
public static void main
(String[] args
) { System.
out.
println(digit
(98765,
5)); }
static int digit(int a, int b) {
return a
/ (int)Math.
pow(10, b
- 1) % 10; }
}
Y2xhc3MgSWRlb25lIHsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB7CgkJU3lzdGVtLm91dC5wcmludGxuKGRpZ2l0KDk4NzY1LCA1KSk7Cgl9CgogICAgc3RhdGljIGludCBkaWdpdChpbnQgYSwgaW50IGIpIHsKICAgICAgICByZXR1cm4gYSAvIChpbnQpTWF0aC5wb3coMTAsIGIgLSAxKSAlIDEwOwogICAgfQp9