## Finding all Permutations that add up to a number.

The program's description is as follows:
Create a routine that will take n integer, from 1 to n ^ 2,inclusive, and find all possible permutations where the n integers add up to n*(n*n + 1) / 2 with the qualification that none of the integers are equal to any of the other integers.

Right now I have a case by case based program for each n but I was told to make it work for all cases.
```public static void createPerm3(){//works only if(n==3)
for(int i = 1; i <= n * n; i++)
for(int j = 1; j <= n * n; j++)
if(i != j && i != mg-i-j && j != mg-i-j &&mg-i-j <= n * n && mg-i-j >0){
Integer[] temp = {i,j,mg-i-j};
perm.add(deepCopy(temp));}//deepCopy returns a manual copy of the array
}
public static void createPerm4(){//works only if(n==4)
for(int i = 1; i <= n * n; i++)
for(int j = 1; j <= n * n; j++)
for(int k = 1; k <= n * n; k++)
if(i != j && i !=k && i != mg-i-j-k && j != k && j != mg-i-j-k && k != mg-i-j-k && mg-i-j-k <= n * n && mg-i-j-k >0){
Integer[] temp = {i,j,k,mg-i-j-k};