code: private boolean checkSeVatId(final String pvatId) {
      final int checkSum = pvatId.charAt(11) - '0';
      final int sum = squareSum((pvatId.charAt(2) - '0') * 2) + pvatId.charAt(3) - '0'
          + squareSum((pvatId.charAt(4) - '0') * 2) + pvatId.charAt(5) - '0'
          + squareSum((pvatId.charAt(6) - '0') * 2) + pvatId.charAt(7) - '0'
          + squareSum((pvatId.charAt(8) - '0') * 2) + pvatId.charAt(9) - '0'
          + squareSum((pvatId.charAt(10) - '0') * 2);
      int calculatedCheckSum = 10 - sum % 10;
      if (calculatedCheckSum == 10) {
        calculatedCheckSum = 0;
      }
      return checkSum == calculatedCheckSum;
    }
docs: check the VAT identification number, country version for Sweden.
  
  @param pvatId vat id to check
  @return true if checksum is ok