Java program to find the occurrence of a digit in a number