Bit Vector : Vector « Game « Android






Bit Vector

 
public class BitVector {
  private final int DEFAULT_SIZE = 1024;
  private byte[] buffer = null;
  private int index = 0;
  public BitVector( int size ) {
    buffer = new byte[ size ];
  }
  public void append( byte[] buffer , int offSet , int length ){
    if( index + length > this.buffer.length ){
      byte[] tmp = new byte[ index + length ];
      System.arraycopy( this.buffer , 0 , tmp , 0 , index );
      System.arraycopy( buffer , offSet , tmp , index , length );
      this.buffer = tmp;
      this.index += length;
    }else{
      System.arraycopy( buffer , offSet , this.buffer , index , length );
      index += length;
    }
  }
  
  public byte[] getBuffer(){
    return buffer;
  }

}

   
  








Related examples in the same category

1.Wrapper activity demonstrating the use of the new SensorEvent rotation vector sensor, Sensor#TYPE_ROTATION_VECTOR TYPE_ROTATION_VECTOR}).
2.Vector2d structure
3.Vector2 Structure
4.Convenience library to do vector calculations
5.Vector3
6.Compute the dot product of two vectors
7.Compute the cross product of two vectors
8.Compute the magnitude (length) of a vector
9.Vector3 structure