def to_integer(array, signed=false)
         from = nil
         to   = nil
         data = []

         if array.size == 2
            data.concat(get_endian == BIG_ENDIAN ? array.reverse : array)
            from = 'C2'
            to   = signed ? 's' : 'S'
         else
            data.concat(get_endian == BIG_ENDIAN ? array[0,4].reverse : array)
            from = 'C4'
            to   = signed ? 'l' : 'L'
         end
         data.pack(from).unpack(to)[0]
      end
def to_integer(array, signed=false)
         from = nil
         to   = nil
         data = []

         if array.size == 2
            data.concat(get_endian == BIG_ENDIAN ? array.reverse : array)
            from = 'C2'
            to   = signed ? 's' : 'S'
         else
            data.concat(get_endian == BIG_ENDIAN ? array[0,4].reverse : array)
            from = 'C4'
            to   = signed ? 'l' : 'L'
         end
         data.pack(from).unpack(to)[0]
      end
This method converts an array to an integer. The array must be either
 two or four bytes in length.

 ==== Parameters
 array::    A reference to the array containing the data to be converted.
 signed::   A boolean to indicate whether the value is signed. Defaults
            to false.