how can I solve this code does not print as it should

0
package Parcial;


import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class NewMain {

    public static void main(String[] args) {

        //1024-256-128-64-16-8-4-2
        int contador = 0, i = 0, multi , option;
        boolean val = true;
        List<Integer> list = new ArrayList<>();
        List<Integer> listAux = new ArrayList<>();


        while (contador < 1024) {
            contador = (int) Math.pow(2, i);
            if (contador > 1) {
                list.add(contador);

            }
            i++;
        }
        list = list.stream().sorted((o1, o2) -> o2.
                compareTo(o1)).
                collect(Collectors.toList());

        while (val) {
            System.out.println("Ingrese numero multiplo de 3 para el inicio ");
            multi = Leer.datoInt();
            while(multi % 3 != 0){
                System.out.println("ERROR NO ES MULTIPLO VOLVER A INGRESARLO ");
                multi = Leer.datoInt();
            }
            listAux.add(multi);
            System.out.println("Va a ingresar mas multiplos imprima cualquier tecla de lo contrario oprima 2");
            option = Leer.datoInt();
            if(option == 2){
                val = false;
            }
        }
        val = true;
        listAux.addAll(list);
        list = listAux;
        listAux = new ArrayList<>();
         while (val) {
            System.out.println("Ingrese numero multiplo de 4 para el inicio  ");
            multi = Leer.datoInt();
            while(multi % 4 != 0){
                System.out.println("ERROR NO ES MULTIPLO VOLVER A INGRESARLO ");
                multi = Leer.datoInt();
            }
            listAux.add(multi);
            System.out.print("Va a ingresar mas multiplos imprima cualquier tecla de lo contrario oprima 2");
            option = Leer.datoInt();
            if(option == 2){
                val = false;
            }
        }

        list.addAll(listAux);


        for (Integer integer : list) {
            System.out.println("num: " + integer);
        }
    }

}
    
asked by juandavid903005 10.10.2018 в 01:44
source

0 answers