It's best to use a new chain when fitting a new cassette (old chain on a new cassette will accelerate the wear on the cassette).
The usual method of judging the length of new chain is to wrap it round the biggest chain ring and the biggest sprocket without running it through the derailleurs. That length + 2 links is the length needed.