Find nth Magic Number Easy Java Soln


#1
` public int solve(int num) {
    String str=Integer.toBinaryString(num);
    str=new StringBuilder(str).reverse().toString();
    int ans=0;
    
    for(int i=0;i<str.length();i++){
        ans+=(Math.pow(5,i+1)*Integer.parseInt(str.charAt(i)+""));
    }
    return ans;
}`