Java Vector getNonNullVectors(int[][] usageM)

Here you can find the source of getNonNullVectors(int[][] usageM)

Description

get Non Null Vectors

License

Open Source License

Declaration

public static int[][] getNonNullVectors(int[][] usageM) 

Method Source Code

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

import java.util.*;

public class Main {
    public static int[][] getNonNullVectors(int[][] usageM) {
        List<int[]> nonNullVectors = new ArrayList<int[]>();

        for (int[] v : usageM) {
            boolean isNull = true;
            for (int i = 0; i < v.length; i++)
                if (v[i] > 0)
                    isNull = false;//  w  w  w.  j  a v a  2 s  .com
            if (!isNull)
                nonNullVectors.add(v);
        }

        int[][] newUsageM = new int[nonNullVectors.size()][];
        for (int i = 0; i < newUsageM.length; i++) {
            newUsageM[i] = nonNullVectors.get(i);
        }

        return newUsageM;
    }
}

Related

  1. Contains(Vector V, int[] elt)
  2. copyVector(Vector V)
  3. deleteLast(Vector list)
  4. enumerationToVector(Enumeration pEnumeration_)
  5. getCommaListFromVector(Vector sourceVector)
  6. hasDuplicates(Vector v)
  7. isContained(Object obj, Vector vect)
  8. median(double[] vector)
  9. normVector(List v1)