Java Array Min Value min(int[] in, int x1, int x2)

Here you can find the source of min(int[] in, int x1, int x2)

Description

min

License

Open Source License

Declaration

static public int min(int[] in, int x1, int x2) 

Method Source Code

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

public class Main {
    static public int min(int[] in, int x1, int x2) {

        int minval = 999999;

        if (in != null && x1 >= 0) {

            for (int i = x1; i < Math.min(in.length, x2); i++) {

                if (in[i] != 0)
                    minval = Math.min(in[i], minval);

            }//from w ww.  j  a va2s  . com
        }

        return minval;

    }

    static public int min(int[] in) {

        int minval = 999999;

        if (in != null) {

            for (int i = 0; i < in.length; i++) {

                if (in[i] != 0)
                    minval = Math.min(in[i], minval);

            }
        }

        return minval;

    }
}

Related

  1. min(int[] array)
  2. min(int[] array)
  3. min(int[] array)
  4. min(int[] array)
  5. min(int[] elements)
  6. min(int[] list)
  7. min(int[] values)
  8. min(int[] values)
  9. min(int[] vs)