code: public int[][] getVariations() {
  		int permutations = (int) Math.pow(n, r);
  		int[][] table = new int[permutations][r];
  
  		for (int x = 0; x < r; x++) {
  			int t2 = (int) Math.pow(n, x);
  			for (int p1 = 0; p1 < permutations;) {
  				for (int al = 0; al < n; al++) {
  					for (int p2 = 0; p2 < t2; p2++) {
  						table[p1][x] = al;
  						p1++;
  					}
  				}
  			}
  		}
  
  		return table;
  	}
docs: Get all r-permutations of n integers.
  @return All r-permutations of n integers.