Skálavariációk

Futtatható Java-kód a variációs lista kiszámítására

 

Bináris

Számsoros

 

Bináris

 

import java.util.ArrayList;

public class Main {
public static void main(String[] args) {
ArrayList<String> store1 = new ArrayList<String>();
ArrayList<String> store2 = new ArrayList<String>();
ArrayList<String> store3 = new ArrayList<String>();
ArrayList<String> store4 = new ArrayList<String>();
ArrayList<String> store5 = new ArrayList<String>();
ArrayList<String> store6 = new ArrayList<String>();
ArrayList<String> store7 = new ArrayList<String>();
ArrayList<String> store8 = new ArrayList<String>();
int count = 1;
int countGroups = 1;

for (int a = 0; a <= 1; a++){
    for (int b = 0; b <= 1; b++){
        for (int c = 0; c <= 1; c++){
            for (int d = 0; d <= 1; d++){
                for (int e = 0; e <= 1; e++){
                    for (int f = 0; f <= 1; f++){
                        for (int g = 0; g <= 1; g++){
                            for (int h = 0; h <= 1; h++){
                                String str_a = Integer.toString(a);
                                String str_b = Integer.toString(b);
                                String str_c = Integer.toString(c);
                                String str_d = Integer.toString(d);
                                String str_e = Integer.toString(e);
                                String str_f = Integer.toString(f);
                                String str_g = Integer.toString(g);
                                String str_h = Integer.toString(h);
                                String store = str_a + str_b + str_c + str_d + str_e + str_f + str_g + str_h;
                                int numberBits = 0;
                                for(int iterator = 0; iterator < store.length(); iterator++) {
                                    char result = store.charAt(iterator);
                                    if(result == '1'){
                                        numberBits++;
                                        }
                                }
                                switch (numberBits) {
                                    case (1): store1.add(store); break;
                                    case (2): store2.add(store); break;
                                    case (3): store3.add(store); break;
                                    case (4): store4.add(store); break;
                                    case (5): store5.add(store); break;
                                    case (6): store6.add(store); break;
                                    case (7): store7.add(store); break;
                                    case (8): store8.add(store); break;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

System.out.println(countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store1.size(); i++) {
    System.out.println(count++ + ". - " + store1.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store2.size(); i++) {
    System.out.println(count++ + ". - " + store2.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store3.size(); i++) {
    System.out.println(count++ + ". - " + store3.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store4.size(); i++) {
    System.out.println(count++ + ". - " + store4.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store5.size(); i++) {
    System.out.println(count++ + ". - " + store5.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store6.size(); i++) {
    System.out.println(count++ + ". - " + store6.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store7.size(); i++) {
    System.out.println(count++ + ". - " + store7.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store8.size(); i++) {
    System.out.println(count++ + ". - " + store8.get(i));
        }
    }
}

 

Számsoros

 

import java.util.ArrayList;

public class Main {
public static void main(String[] args) {
ArrayList<String> store1 = new ArrayList<String>();
ArrayList<String> store2 = new ArrayList<String>();
ArrayList<String> store3 = new ArrayList<String>();
ArrayList<String> store4 = new ArrayList<String>();
ArrayList<String> store5 = new ArrayList<String>();
ArrayList<String> store6 = new ArrayList<String>();
ArrayList<String> store7 = new ArrayList<String>();
ArrayList<String> store8 = new ArrayList<String>();

String store = "";
String str_a = "";
String str_b = "";
String str_c = "";
String str_d = "";
String str_e = "";
String str_f = "";
String str_g = "";
String str_h = "";

int count = 1;
int countGroups = 1;

for (int a = 0; a <= 1; a++){
    for (int b = 0; b <= 1; b++){
        for (int c = 0; c <= 1; c++){
            for (int d = 0; d <= 1; d++){
                for (int e = 0; e <= 1; e++){
                    for (int f = 0; f <= 1; f++){
                        for (int g = 0; g <= 1; g++){
                            for (int h = 0; h <= 1; h++){
                                str_a = Integer.toString(a);

                                if(b != 0) {
                                    str_b = Integer.toString(2);
                                }
                                else
                                    str_b = Integer.toString(b);

                                if(c != 0) {
                                    str_c = Integer.toString(3);
                                }
                                else
                                    str_c = Integer.toString(c);

                                if(d != 0) {
                                    str_d = Integer.toString(4);
                                }
                                else
                                    str_d = Integer.toString(d);

                                if(e != 0) {
                                    str_e = Integer.toString(5);
                                }
                                else
                                    str_e = Integer.toString(e);

                                if(f != 0) {
                                    str_f = Integer.toString(6);
                                }
                                else
                                    str_f = Integer.toString(f);

                                if(g != 0) {
                                    str_g = Integer.toString(7);
                                }
                                else
                                    str_g = Integer.toString(g);

                                if(h != 0) {
                                    str_h = Integer.toString(8);
                                }
                                else
                                    str_h = Integer.toString(h);

                                store = str_a + str_b + str_c + str_d + str_e + str_f + str_g + str_h;

                                int numberBits = 0;
                                for(int i = 0; i < store.length(); i++) {
                                    char result = store.charAt(i);
                                    if(result != '0'){
                                    numberBits++;
                                }
                            }

                            switch (numberBits) {
                                case (1): store1.add(store); break;
                                case (2): store2.add(store); break;
                                case (3): store3.add(store); break;
                                case (4): store4.add(store); break;
                                case (5): store5.add(store); break;
                                case (6): store6.add(store); break;
                                case (7): store7.add(store); break;
                                case (8): store8.add(store); break;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

System.out.println(countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store1.size(); i++) {
    System.out.println(count++ + ". - " + store1.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store2.size(); i++) {
    System.out.println(count++ + ". - " + store2.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store3.size(); i++) {
    System.out.println(count++ + ". - " + store3.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store4.size(); i++) {
    System.out.println(count++ + ". - " + store4.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store5.size(); i++) {
    System.out.println(count++ + ". - " + store5.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store6.size(); i++) {
    System.out.println(count++ + ". - " + store6.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store7.size(); i++) {
    System.out.println(count++ + ". - " + store7.get(i));
}

System.out.println();
System.out.println(++countGroups + " ritmikai képletből álló csoport:");

for(int i = 0; i < store8.size(); i++) {
    System.out.println(count++ + ". - " + store8.get(i));
        }
    }
}