How can I get the num. of the array larger and equal to the value that I enter? [closed]

-4
public double[] ejercicio4(double[] b){
    Vector<Double> tmp = new Vector<>();
    for(int i = 0; i < b.length; i++)
    {
        boolean found = false;
        for(int j = 0; j < tmp.size(); j++)
        {
            if(tmp.get(j).doubleValue() == b[i])
                found = true;
        }
        if(!found)
            tmp.add(b[i]);
    }
    double rat[] = new double[tmp.size()];
    for(int i = 0; i < tmp.size(); i++)
    {
        rat[i] = tmp.get(i);
    }
    return rat;
}


public static void main(String[] args){
    double[] arraybro = {3, -5, 2.4, 0, 17};
    double[] b = ejercicio4(arraybro);
    Scanner lector = new Scanner(System.in);
    System.out.print("Introduzca un numero: ");
    System.out.print("{3, -5, 2.4, 0, -5, 17, 3}    ----->    ");
    for(int i=0;i<arraybro.length;i=i+2){
        int aux;
        if(arraybro[i]<arraybro[i+2]){
            aux=(int) arraybro[i+2];
            arraybro[i+2]=arraybro[i];
            arraybro[i]=aux;
        }
    }
}
    
asked by lethal_shooter 12.04.2018 в 16:26
source

0 answers