public Piece(int index, int length, byte[] hash){
		this.index = index;
		this.length = length;
		this.hash = hash;
		blocks = new HashMap<Integer,Block>();
		
		int count = this.length / MAX_BLOCK_LENGTH;
		if(this.length % MAX_BLOCK_LENGTH > 0)
			count++;
		
		this.blockOffsets = new int[count];
		this.blockLengths = new int[count];
		this.blockLastRequested = new long[count];
		
		for(int i = 0; i < count;i++){
			this.blockOffsets[i] = (i * MAX_BLOCK_LENGTH);
			this.blockLengths[i] = MAX_BLOCK_LENGTH;
			if(i == count - 1 && this.length % MAX_BLOCK_LENGTH > 0)
				this.blockLengths[i] = (this.length % MAX_BLOCK_LENGTH);
		}
	}