public static short RetrieveShort(byte[] ToArray, int atIndex)
{
int limit=SHORTSTORAGE;
if (atIndex+limit>ToArray.Length)
{
throw new BufferFileException("can't access beyond end of array");
}
int result = 0;
for (int i=0; i<limit; i++)
{
byte thebyte = ToArray[atIndex+limit-i-1];
result = (result << 8);
result = result | thebyte;
}
return (short) result;
}