code: public static char getChecksum(String text) {
          int mul = 3;
          int total = 0;
          for (int k = text.length() - 1; k >= 0; --k) {
              int n = text.charAt(k) - '0';
              total += mul * n;
              mul ^= 2;
          }
          return (char)(((10 - (total % 10)) % 10) + '0');
      }
docs: Calculates the checksum.
  @param text the numeric text
  @return the checksum