emodev

Untitled

Dec 14th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. package Recursion_Sorting_and_Searching;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.InputStreamReader;
  5. import java.util.Arrays;
  6.  
  7. public class Vectors {
  8.     public static void main(String[] args) {
  9.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  10.         int[] arr = new int[9];
  11.         Generate(0,arr);
  12.  
  13.     }
  14.  
  15.     private static void Generate(int index, int[] arr) {
  16.         if (index == arr.length) {
  17.             System.out.println(String.join(", ", Arrays.toString(arr)));
  18.         } else {
  19.             for (int i = 0; i <= 9; i++) {
  20.                 arr[index] = i;
  21.                 Generate(index + 1,arr);
  22.             }
  23.         }
  24.     }
  25. }
Add Comment
Please, Sign In to add comment