doubleSize

Category: Arrays
Author: Stuart Reges
Book Chapter: 7.2
Problem: doubleSize
  Write a static method called doubleSize that takes an
   array of integers as an argument and that returns a new array twice as large
   as the original that replaces every integer from the original list with a
   pair of integers, each half the original.  If a number in the original list
   is odd, then the first number in the new pair should be one higher than the
   second so that the sum equals the original number.  For example, if a
   variable called list stores this sequence of values:

	[18, 7, 4, 24, 11]

   The number 18 is split into the pair (9, 9), the number 7 is split into (4,
   3), the number 4 is split into (2, 2), the number 24 is split into (12, 12)
   and the number 11 is stretched into (6, 5).  Thus, the call:

        int[] result = doubleSize(list);

   should return an array containing this sequence:

	[9, 9, 4, 3, 2, 2, 12, 12, 6, 5]

   Your method should not change the array passed as a parameter.  You are not
   allowed to solve this problem using an ArrayList or Scanner and you are not
   allowed to call any methods of the Arrays class or the Collections class.