Java Array Remove removeLowScore(int[] array)

Here you can find the source of removeLowScore(int[] array)

Description

remove Low Score

License

Open Source License

Declaration

public static int[] removeLowScore(int[] array) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    public static int[] removeLowScore(int[] array) {
        int low = findLowPos(array);
        ArrayList<Integer> outList = new ArrayList<Integer>();
        for (int i : array)
            if (i != low)
                outList.add(i);/*from   w  w  w .j a  va  2s . com*/
        outList.trimToSize();
        int[] outArray = new int[outList.size()];
        for (int i = 0; i < outArray.length; i++)
            outArray[i] = outList.get(i);
        return outArray;
    }

    private static int findLowPos(int[] array) {
        int low = array[0];
        for (int i : array)
            if (i < low)
                low = i;
        return low;
    }
}

Related

  1. removeFromArray(String[] oldArray, String stringToRemove)
  2. removeId(byte[] in, Integer id)
  3. removeIndex(String[] args, int index)
  4. removeIndex(T[] array, int index)
  5. removeLast(byte[] target, int end)
  6. removeMethodsOption(String[] args)
  7. removeNaN(double[] x1)
  8. removeNodes(T[] array, T sampleNode)
  9. removeNull(T[] data)