I would suggest that when you break the numbers into the four characters and place into the array, why not just convert them into a two byte numeric integer. All computations after that would be much faster.