there 2 sets of matrices i.e. a(1 500 matrices) , b(150 000 matrices). for each matrix set a, iterate through elements b b checking criteria on , b (if it's true matrix b, stop iterating , return true. if no match found after iterating entire set b, return false). my question how make program parallel using java? i understand matrices sets quite big (the numbers of elements posted above instance, in real-life case bigger). how correctly computations? create 1 5000 threads , computation not idea. optimal amount of threads, take computational work? as said, may need check pair , there no heuristic order of checking if checking not need i/o or sth cause wast of cpu, if have 4 example 4 core, create 4 thread(0-3) , thread responsible checking a(4k+i) , every b . , before each checking in each thread, must check whether find true pair or not, can accomplished static variable in classes extends thread public class worker extends thread{ static int found=0; ...