title: Divisibility 9 Using Bitwise Operators
signature: class Solution {
  
      public Boolean divisibility9UsingBitwiseOperators(Integer n) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Boolean expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(96, false);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(85, false);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(54, true);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(14, false);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(47, false);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(11, false);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(49, false);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(99, true);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(28, false);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(82, false);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Boolean expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n),expected);
      }
      
      public boolean validateSolution(Boolean actual, Boolean expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def divisibility_9_using_bitwise_operators(n):
      if ((n == 0) or (n == 9)):
          return True
      if (n < 9):
          return False
      return divisibility_9_using_bitwise_operators((int((n >> 3)) - int((n & 7))))
source_cpp: bool divisibility_9_using_bitwise_operators(int n) {
    if ( n == 0 || n == 9 ) return true;
    if ( n < 9 ) return false;
    return divisibility_9_using_bitwise_operators ( ( int ) ( n >> 3 ) - ( int ) ( n & 7 ) );
  }