For this Question: Given an n-digit large number in form of string, check whether it is divisible by 7 or not. Print 1 if divisible by 7, otherwise 0.There is a number num is given in input.

Constraint:
1 ≤ |num| ≤ 10^5Print 1 if num is divisible by 7, otherwise 0.Sample Input:
8955795758

Sample Output:
1, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static void main (String[] args) throws Exception{
    InputStreamReader reader = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(reader);
     String num=br.readLine();
    int n = num.length();

        if (n == 0 && num.charAt(0) == '0') {
            System.out.println(1);
        }
        if (n % 3 == 1)
            num = "00" + num;
        if (n % 3 == 2)
            num = "0" + num;
        n = num.length();


        int gSum = 0, p = 1;
        for (int i = n - 1; i >= 0; i--) {


            int group = 0;
            group += num.charAt(i--) - '0';
            group += (num.charAt(i--) - '0') * 10;
            group += (num.charAt(i) - '0') * 100;
            gSum = gSum + group * p;

            p = p * -1;
        }
        if(gSum%7==0){
            System.out.println(1);
        }
        else{
            System.out.println(0);
        }



    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?