printNumber

Category: Arrays
Author: Stuart Reges
Book Chapter: 7.2
Problem: printNumber
Write a static method printNumber that takes an array of
   integers that represent the digits of a large integer, as in assignment #6,
   and that prints the integer with commas between every 3 digits starting from
   the right.  You may assume that the values in the array are all between 0
   and 9 and that there are no leading 0's.  For example, if the array contains
   the digits (1, 5, 0, 0), then your method should produce the following
   output:

        1,500

   If the array instead contains the digits (3, 8, 4, 9, 2, 1, 4, 7), then your
   method should produce the following output:

        38,492,147

   Your method might not print any commas if the number is small enough.  For
   example, if the array contains the digits (2, 5, 0), then your method should
   produce the following output:

        250

   Your method should produce an entire line of output so that if it is called
   several times in a row, each call will produce a separate line of output.   

   Write your solution to printNumber below.