digitsInARow

Category: Programming
Author: Stuart Reges
Book Chapter: 5.1
Problem: digitsInARow
  Write a static method called digitsInARow that takes
   an integer n as a parameter and that returns the highest number of digits
   that appear in a row in the base-10 representation of n.  For many numbers
   the answer will be 1 because they don't have adjacent digits that match.
   But for a number like 3555585, the answer is 4 because there are four
   occurrences of the digit 5 that appear in a row.  Below are sample calls on
   the method.

        Method                  Value          Method                  Value
         Call                  Returned         Call                  Returned
        -------------------------------        -------------------------------
        digitsInARow(0)           1            digitsInARow(8823)        2
        digitsInARow(18)          1            digitsInARow(777)         3
        digitsInARow(394)         1            digitsInARow(82888)       3
        digitsInARow(99)          2            digitsInARow(7111171)     4
        digitsInARow(8229)        2            digitsInARow(233333888)   5

   You are NOT allowed to use a String to solve this problem.  You may assume
   that the value passed to the method is greater than or equal to 0.

   Write your solution to method digitsInARow below.