Problem: Given a number N. The task is to complete the function convertFive() which replace all zeros in the number with 5 my code| plz validate any help me
public class Replaceall0swith5 {
    public static void convertFive(int n) {
    //add code here.
        int digit, sum = 0;
        while (n > 0) {
            digit = n % 10;
            if (digit == 0) {
                digit = 5;
            }
            sum = sum * 10 + digit;
            n = n / 10;
        }
        System.out.print(n + " All O's replaced with 5 " + sum);
    }
    public static void main(String[] args) {
        Replaceall0swith5.convertFive(1004);
    }
}
 
     
     
    