Wie löscht man die ersten paar Elemente aus einem array von strings?

Ich habe eine Methode in einem string-array und findet den Durchschnitt von jedem paar Elemente, je nach Länge. Ich möchte die Methode zum löschen der ersten paar Elemente in das array je nach dem Wert von offset.

public static double[] getMovingAverage(String[] priceList, int length, int offset){

    double[] newPriceList = convert(priceList);

    int listLength = newPriceList.length;
    int counter = 0;
    double listsum;
    double[] movingAverage = new double[listLength];

    try{
        for (int aa = 0; aa < listLength-1; aa++){
            listsum = 0;
            for (int bb = 0; bb < length; bb++){
                counter = aa+bb;

                listsum = listsum + newPriceList[counter];
            }
            movingAverage[aa] = listsum / length;
        }
        if (offset>0){

                        //remove first #offset# elements

        }
    }catch(Exception e){
        System.out.println(e);
    }
    return movingAverage;
}

*Hinweis: convert(); wandelt String [], double[]

InformationsquelleAutor Mike | 2011-06-20
Schreibe einen Kommentar