title: Divisibility By 7
signature: class Solution {
  
      public Boolean divisibilityBy7(Integer num) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer num, Boolean expected){
          try{
              Driver driver = new Driver();
              if (driver.run(num,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(0, true);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(-21, false);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(7, true);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(63, false);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(84, false);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(73, false);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(81, false);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(-10, false);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(47, false);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(23, false);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer num, Boolean expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(num),expected);
      }
      
      public boolean validateSolution(Boolean actual, Boolean expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def divisibility_by_7(num):
      if (num < 0):
          return divisibility_by_7((- num))
      if ((num == 0) or (num == 7)):
          return True
      if (num < 10):
          return False
      return divisibility_by_7(((num / 10) - (2 * (num - ((num / 10) * 10)))))
source_cpp: int divisibility_by_7(int num) {
    if ( num < 0 ) return divisibility_by_7 ( - num );
    if ( num == 0 || num == 7 ) return 1;
    if ( num < 10 ) return 0;
    return divisibility_by_7 ( num / 10 - 2 * ( num - num / 10 * 10 ) );
  }