private static int CalculateChecksum(int[] weights, StringNumber number, bool tverrsum)
        {
            int checksum = 0;

            for (int i = 0; i < weights.Length; i++)
            {
                int weight        = weights[i];
                int currentNumber = number.GetAt(weights.Length - 1 - i);
                int product       = weight * currentNumber;

                if (tverrsum)
                {
                    if (product > 9)
                    {
                        checksum += product - 9;
                    }
                    else
                    {
                        checksum += product;
                    }
                }
                else
                {
                    checksum += product;
                }
            }
            return(checksum);
        }
        private static int CalculateChecksum(int[] weights, StringNumber number, bool tverrsum)
        {
            int checkSum = 0;

            for (int i = 0; i < weights.Length; i++)
            {
                int product = weights[i] * number.GetAt(weights.Length - 1 - i);
                if (tverrsum)
                {
                    checkSum += (product > 9 ? product - 9 : product);
                }
                else
                {
                    checkSum += product;
                }
            }
            return(checkSum);
        }
        private static int CalculateChecksum(int[] weights, StringNumber number, bool tverrsum)
        {
            int checksum = 0;
            for (int i = 0; i < weights.Length; i++)
            {
                int weight = weights[i];
                int currentNumber = number.GetAt(weights.Length - 1 - i);
                int product = weight*currentNumber;

                if (tverrsum)
                {
                    if (product > 9) checksum += product - 9;
                    else checksum += product;
                }
                else
                {
                    checksum += product;
                }
            }
            return checksum;
        }