fork download
  1. class Ideone {
  2. public static void main (String[] args) {
  3. System.out.println(digit(98765, 5));
  4. }
  5.  
  6. static int digit(int a, int b) {
  7. return a / (int)Math.pow(10, b - 1) % 10;
  8. }
  9. }
Success #stdin #stdout 0.08s 52556KB
stdin
Standard input is empty
stdout
9