public static function shortToBytes($value, $endian)
    {
        if ($endian == self::LITTLE_ENDIAN) {
            return chr($value) . chr($value >> 8);
        } else {
            return chr($value >> 8) . chr($value);
        }
    }