Java Array Min Value minList(int[] listA, int[] listB)

Here you can find the source of minList(int[] listA, int[] listB)

Description

min List

License

Apache License

Declaration

public static int[] minList(int[] listA, int[] listB) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int[] minList(int[] listA, int[] listB) {
        int maxSize = Math.max(listA.length, listB.length);
        int[] minList = new int[maxSize];
        for (int i = 0; i < maxSize; i++) {
            int valueA = i < listA.length ? listA[i] : Integer.MAX_VALUE;
            int valueB = i < listB.length ? listB[i] : Integer.MAX_VALUE;

            valueA = valueA >= 0 ? valueA : Integer.MAX_VALUE;
            valueB = valueB >= 0 ? valueB : Integer.MAX_VALUE;

            int minValue = Math.min(valueA, valueB);

            if (minValue == Integer.MAX_VALUE)
                minValue = -1;//from   w ww.ja  va2 s  . co m

            minList[i] = minValue;
        }

        return minList;
    }
}

Related

  1. minIndexGreaterThan(final double[] array, final double p)
  2. minInRowIndex(double[][] M, int row)
  3. minInt(int... values)
  4. minkowskiDistance(double[] coord1, double[] coord2)
  5. minLengthCheck(final byte[] buffer, final byte length)
  6. minLocation(double[] list)
  7. minmax(double[] a)
  8. minMax(float... values)
  9. minMax(float[] array)