Example usage for java.lang Double MIN_VALUE

List of usage examples for java.lang Double MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Double MIN_VALUE.

Prototype

double MIN_VALUE

To view the source code for java.lang Double MIN_VALUE.

Click Source Link

Document

A constant holding the smallest positive nonzero value of type double , 2-1074.

Usage

From source file:Main.java

public static double max(double... vals) {
    double max = Double.MIN_VALUE;
    for (double d : vals)
        if (max < d)
            max = d;//from w  w w. j  a v  a  2 s .  c  o m
    return max;
}

From source file:Main.java

public static int maxIndex(double[] input, int limit) {
    double max = Double.MIN_VALUE;
    int index = -1;
    for (int i = 0; i < input.length && i < limit; i++) {
        if (input[i] > max) {
            max = input[i];//from w  w  w  . ja va 2  s . co m
            index = i;
        }
    }
    return index;
}

From source file:Main.java

/**
 * scales all data between -1 and 1// w  w  w  .ja  va  2  s  . c o m
 *
 * @param data the data to scale
 * @return scaled data
 */
public static double[] scaleToOne(double[] data) {
    double max = Double.MIN_VALUE;
    for (double d : data) {
        if (d > max)
            max = d;
    }
    for (int i = 0; i < data.length; i++)
        data[i] /= max;

    return data;
}

From source file:Main.java

/*************************************
 * data type conversion/*from   w  w  w.  jav a  2  s  . c o  m*/
 **************************************/
public static int idxOfMax(double[] values) {
    int ret = -1;
    double max = Double.MIN_VALUE;
    for (int i = 0; i < values.length; i++) {
        if (values[i] > max) {
            max = values[i];
            ret = i;
        }
    }
    return ret;
}

From source file:Main.java

public static void getTop(double[] array, ArrayList<Integer> rankList, int i) {
    int index = 0;
    HashSet<Integer> scanned = new HashSet<Integer>();
    double max = Double.MIN_VALUE;
    for (int m = 0; m < i && m < array.length; m++) {
        max = Double.MIN_VALUE;/*from  w w  w. java2  s. co  m*/
        for (int no = 0; no < array.length; no++) {
            if (!scanned.contains(no)) {
                if (array[no] > max) {
                    index = no;
                    max = array[no];
                } else if (array[no] == max && Math.random() > 0.5) {
                    index = no;
                    max = array[no];
                }
            }
        }
        if (!scanned.contains(index)) {
            scanned.add(index);
            rankList.add(index);
        }
        //System.out.println(m + "\t" + index);
    }
}

From source file:Main.java

public static Bitmap divide(Bitmap bitmap1, Bitmap bitmap2) {
    double alpha = Double.MIN_VALUE;
    int width = bitmap1.getWidth();
    int height = bitmap1.getHeight();
    Bitmap grayBitmap1 = toGrayScale(bitmap1);
    Bitmap grayBitmap2 = toGrayScale(bitmap2);
    Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    for (int x = 0; x < width; x++)
        for (int y = 0; y < height; y++) {
            int value1 = Color.blue(grayBitmap1.getPixel(x, y));
            int value2 = Color.blue(grayBitmap2.getPixel(x, y));
            //                int resultValue = (int) (Math.abs((Math.log((value1 + alpha)/(value2 + alpha))) * 1000));
            int resultValue = (int) ((Math.abs(Math.log((value1 + alpha) / (value2 + alpha)))) * 255);
            result.setPixel(x, y, Color.rgb(resultValue, resultValue, resultValue));
        }/*from  w w  w .  ja  v a 2  s . c  om*/
    //        grayBitmap1.recycle();
    //        grayBitmap2.recycle();
    return result;
}

From source file:Main.java

/**
 * computes the maximal value of a passed array
 * @param _arr the array to get the maximum from
 * @return a double[] of size 2. the first index holds the maximum value of the passed array,
 * the second index holds the index where the maximum value is in the passed array
 *///from   w w w. ja  v a 2s  .co  m
public static double[] max(double[] _arr) {
    double max = Double.MIN_VALUE;
    double maxIdx = -1;

    for (int i = 0; i < _arr.length; i++) {
        if (_arr[i] > max) {
            max = _arr[i];
            maxIdx = i;
        }
    }
    return new double[] { max, maxIdx };
}

From source file:Main.java

public static int getMatchingThresholdFromString(String value) throws ParseException {
    char percent = new DecimalFormatSymbols().getPercent();
    value = value.replace(percent, ' ');
    Number number = NumberFormat.getNumberInstance().parse(value);
    double parse = number.doubleValue();
    double p = Math.log10(Math.max(Double.MIN_VALUE, Math.min(1, parse / 100)));
    return Math.max(0, (int) Math.round(-12 * p));
}

From source file:Main.java

public static double[] getMaxValue(double[] val) {
    double max = Double.MIN_VALUE;
    int index = 0;
    for (int i = 0; i < val.length; i++) {
        double v = val[i];
        if (v > max) {
            max = v;/*w ww .j a v a2s  .c om*/
            index = i;
        }
    }
    return new double[] { max, index };

}

From source file:Main.java

/**
 * Returns the maximum value in array/* www  . j  a  v a2 s  . co  m*/
 * @param array   A {@code double} array 
 * @return Max value in {@code array}
 * */
public static double max(double[] array) {
    double max = Double.MIN_VALUE;
    for (int i = 0; i < array.length; i++)
        if (array[i] > max)
            max = array[i];
    return max;
}