Your task is to create a Java program with the name that asks the user for 5 integers in the main method that are between 0 and 9, inclusive. You should then write a method called “permutations” which accepts these 5 integers and prints all possible permutations for those numbers. (Hint: You will need 5 nested loops and an array to do this. Store the 5 numbers in an array inside the method and use the 5 loops to generate all possible array position combinations). Next, after this method is called, generate all possible permutations for (9 – 1st number), (9 – 2nd number), (9 – 3rd number), (9 – 4th number), and (9 – 5th number). For example, if the first time you entered the numbers (5, 6, 7, 8, 9), the second time the method is called the numbers will be (4, 3, 2, 1, 0). It is okay for this assignment if there are duplicate permutations that are printed.(adsbygoogle = window.adsbygoogle || []).push({});

And the next part is do the same problem but make sure there are no duplicate permutations.

i dont really know any discrete math, so any insight to this problem would be great.

i tried to conceptualize it in terms of switching indices of an array, but i dont quite know how to formulate it.

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: Last Java programming questions

**Physics Forums | Science Articles, Homework Help, Discussion**