public void _writeFIntArr(int v[], int off, int len) throws IOException {
        final int free = 5 * len;
        buffout.ensureFree(free);
        final byte[] buf = buffout.buf;
        int count = buffout.pos;
        for (int i = off; i < off+len; i++) {
            final int anInt = v[i];
            if ( anInt > -127 && anInt <=127 ) {
                buffout.buf[count++] = (byte)anInt;
            } else
            if ( anInt >= Short.MIN_VALUE && anInt <= Short.MAX_VALUE ) {
                buf[count++] = -128;
                buf[count++] = (byte) ((anInt >>>  0) & 0xFF);
                buf[count++] = (byte) ((anInt >>> 8) & 0xFF);
            } else {
                buf[count++] = -127;
                buf[count++] = (byte) ((anInt >>>  0) & 0xFF);
                buf[count++] = (byte) ((anInt >>>  8) & 0xFF);
                buf[count++] = (byte) ((anInt >>> 16) & 0xFF);
                buf[count++] = (byte) ((anInt >>> 24) & 0xFF);
            }
        }
        buffout.pos = count;
    }
public void _writeFIntArr ( int v [ ] , int off , int len ) throws IOException { final int free = 5 * len ; buffout . ensureFree ( free ) ; final byte [ ] buf = buffout . buf ; int count = buffout . pos ; for ( int i = off ; i < off + len ; i ++ ) { final int anInt = v [ i ] ; if ( anInt > - 127 && anInt <= 127 ) { buffout . buf [ count ++ ] = ( byte ) anInt ; } else if ( anInt >= Short . MIN_VALUE && anInt <= Short . MAX_VALUE ) { buf [ count ++ ] = - 128 ; buf [ count ++ ] = ( byte ) ( ( anInt > > > 0 ) & 0xFF ) ; buf [ count ++ ] = ( byte ) ( ( anInt > > > 8 ) & 0xFF ) ; } else { buf [ count ++ ] = - 127 ; buf [ count ++ ] = ( byte ) ( ( anInt > > > 0 ) & 0xFF ) ; buf [ count ++ ] = ( byte ) ( ( anInt > > > 8 ) & 0xFF ) ; buf [ count ++ ] = ( byte ) ( ( anInt > > > 16 ) & 0xFF ) ; buf [ count ++ ] = ( byte ) ( ( anInt > > > 24 ) & 0xFF ) ; } } buffout . pos = count ; }
compressed version