Those (six deep!) nested loops don't do anything with those local String variables so they can be removed. That leaves the local ArrayList<String> unused so it can also be removed. That leaves the main( ... ) method empty.

I agree with JosAH. The nested for loops don't do anything as their variables are defined locally inside the loop, so unless you have something else in the loops that didn't copy here, they can be removed.

I agree with JosAH. The nested for loops don't do anything as their variables are defined locally inside the loop, so unless you have something else in the loops that didn't copy here, they can be removed.

but the loops are nested, so the inner loops will have access to the outer variables. the problem is the number of permutations will be 2176782336.

I wanted to do a medical application. I wanted to analyze a raw image in java. I dont want to use any matlab like tools. I wanted to have permutation and combination of the image portion. So that my algorithm can detect ROI. It will be very help if somebody could solve my issue

I wanted to do a medical application. I wanted to analyze a raw image in java. I dont want to use any matlab like tools. I wanted to have permutation and combination of the image portion. So that my algorithm can detect ROI. It will be very help if somebody could solve my issue

i don't see any counting in the code of the op, but perhaps you can show me where this happens.

Yes it is counting; suppose that ArrayList contains the values '0', '1', '2' ... etc. Each nested loop iterates over all values; for the sake of the example asume two nested loops; they will generate the values 00, 01, 02 ... 09, 10, 11, 12 ... 19 ... 90, 91, 92 ...99. IOW it counts to 100. The original example counts in a similar way using different 'digits'.

Yes it is counting; suppose that ArrayList contains the values '0', '1', '2' ... etc. Each nested loop iterates over all values; for the sake of the example asume two nested loops; they will generate the values 00, 01, 02 ... 09, 10, 11, 12 ... 19 ... 90, 91, 92 ...99. IOW it counts to 100. The original example counts in a similar way using different 'digits'.

kind regards,

Jos

ok, but once all "permutation and combination" (or counting :)) are done, what then?

Assuming you have stripped out of this what you actually want to do with this, I will assume that you do actually intend something and so tell you to use a single StringBuilder and its append method rather than creating and discarding 36^6 StringBuffers and Strings (which is what you are doing with the "+" operator).