question: public short [ ] readShortArray ( final int items , final JBBPByteOrder byteOrder ) throws IOException { int pos = 0 ; if ( items < 0 ) { short [ ] buffer = new short [ INITIAL_ARRAY_BUFFER_SIZE ] ; while ( hasAvailableData ( ) ) { final int next = readUnsignedShort ( byteOrder ) ; if ( buffer . length == pos ) { final short [ ] newbuffer = new short [ buffer . length << 1 ] ; System . arraycopy ( buffer , 0 , newbuffer , 0 , buffer . length ) ; buffer = newbuffer ; } buffer [ pos ++ ] = ( short ) next ; } if ( buffer . length == pos ) { return buffer ; } final short [ ] result = new short [ pos ] ; System . arraycopy ( buffer , 0 , result , 0 , pos ) ; return result ; } else { final short [ ] buffer = new short [ items ] ; for ( int i = 0 ; i < items ; i ++ ) { buffer [ i ] = ( short ) readUnsignedShort ( byteOrder ) ; } return buffer ; } }
target:  Read number of short items from the input stream.