public int findFreeNumSmallMemory(File file, final int blocksCount, final int blockSize) throws IOException {
		final int vector_item_size = 32; //because we use int 
		
		int freeBlock;
		if ((freeBlock = findFreeBlock(file, blocksCount, blockSize)) != -1) {						
			
			//find free num in block: read from file
			int[] bitVector = new int[blockSize / vector_item_size]; 
			try (Scanner sc = new Scanner(new FileInputStream(file));) {
				int num;
				while (sc.hasNextInt() && (num = sc.nextInt()) >= 0) {
					if (blockIndex(num, blockSize) == freeBlock) {
						num = num % blockSize;
						bitVector[num / vector_item_size] |= 1 << (num % vector_item_size);	
					}				
				}
			}
			
			//find free num in bitVector
			for (int i = 0; i < bitVector.length; i ++) {
				if (bitVector[i] != 0xFFFFFFFF) { //has free space
					for (int j = 0; j < vector_item_size; j ++) {
						if ((bitVector[i] & (1 << j)) == 0) {
							return freeBlock * blockSize + i * vector_item_size + j;  
						}
					}
				}
			}
		}
		return -1; // no result
	}