List of usage examples for java.lang Float MIN_VALUE
float MIN_VALUE
To view the source code for java.lang Float MIN_VALUE.
Click Source Link
From source file:Main.java
public static float fmax(final float... values) { float max = Float.MIN_VALUE; for (final float v : values) { max = Math.max(v, max);/*from ww w . j av a2 s .c o m*/ } return max; }
From source file:Main.java
/** * Returns next smaller float value considering precision of the argument. * /*from ww w.j av a 2s . c o m*/ */ public static double nextDown(double d) { if (Double.isNaN(d) || d == Double.NEGATIVE_INFINITY) { return d; } else { if (d == 0.0f) { return -Float.MIN_VALUE; } else { return Double.longBitsToDouble(Double.doubleToRawLongBits(d) + ((d > 0.0f) ? -1 : +1)); } } }
From source file:Main.java
public static void getTop(float[] array, ArrayList<Integer> rankList, int i) { rankList.clear();/* w ww.j ava 2s . com*/ int index = 0; HashSet<Integer> scanned = new HashSet<Integer>(); float max = Float.MIN_VALUE; for (int m = 0; m < i && m < array.length; m++) { boolean flag = false; max = Float.MIN_VALUE; for (int no = 0; no < array.length; no++) { if (!scanned.contains(no) && array[no] >= max) { index = no; max = array[no]; flag = true; } } if (flag) { // found value scanned.add(index); rankList.add(index); } } }
From source file:Main.java
public static void getTop(float[] array, ArrayList<Integer> rankList, int i) { rankList.clear();//from w w w .j a va2s. c o m int index = 0; HashSet<Integer> scanned = new HashSet<Integer>(); float max = Float.MIN_VALUE; for (int m = 0; m < i && m < array.length; m++) { boolean flag = false; max = Float.MIN_VALUE; for (int no = 0; no < array.length; no++) { if (!scanned.contains(no) && array[no] >= max) { index = no; max = array[no]; flag = true; } } if (flag) { // found value scanned.add(index); rankList.add(index); // rankProbs.add(array[index]); } // System.out.println(m + "\t" + index); } }
From source file:Main.java
public static void getTopNZ(float[] array, int[] counts, ArrayList<Integer> rankList, ArrayList<Float> rankProbs, int i, int threshold) { // clear/*from ww w. j a v a2s . co m*/ rankList.clear(); rankProbs.clear(); // int index = 0; float max = Float.MIN_VALUE; for (int m = 0; m < i && m < array.length; m++) { boolean flag = false; max = Float.MIN_VALUE; for (int no = 0; no < array.length; no++) { if (counts[no] >= threshold) { if (array[no] >= max && !rankList.contains(no)) { index = no; max = array[no]; flag = true; } } } if (flag) { // found value rankList.add(index); // rankProbs.add(array[index]); rankProbs.add(counts[index] + 0.0f); } //System.out.println(m + "\t" + index); } }
From source file:Main.java
private static float getFloatPreference(Context context, String key) { float value = -1; SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); if (preferences != null) { value = preferences.getFloat(key, Float.MIN_VALUE); }//from w ww. ja va2s.c o m return value; }
From source file:Main.java
/** * Transform all array values from its current min, max range to a, b range * * @param array array to transform/* ww w . ja v a 2s. c o m*/ * @param a new minimum value of array * @param b new maximum value of array * @return transformed array */ public static float[] linearTransform(float[] array, float a, float b) { /* determine current min, max values */ float min = Float.MAX_VALUE; float max = Float.MIN_VALUE; for (int i = 0; i < array.length; i++) { if (array[i] < min) min = array[i]; if (array[i] > max) max = array[i]; } /* linear transformation of matrix values from [min,max] -> [a,b] */ for (int i = 0; i < array.length; i++) { array[i] = a + (b - a) * (array[i] - min) / (max - min); } return array; }
From source file:Main.java
/** * Retrieves a float value from preference manager. If no such key exists, it will return * <code>Float.MIN_VALUE</code>. *//* w ww . j av a 2 s . c o m*/ public static float getFloatFromPreference(Context context, String key) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); return pref.getFloat(key, Float.MIN_VALUE); }
From source file:Main.java
/** * Saves a float value under the provided key in the preference manager. If <code>value</code> * is <code>Float.MIN_VALUE</code>, then the provided key will be removed from the preferences. *//*w w w . java 2 s. c om*/ public static void saveFloatToPreference(Context context, String key, float value) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); if (Float.MIN_VALUE == value) { // we want to remove pref.edit().remove(key).apply(); } else { pref.edit().putFloat(key, value).apply(); } }
From source file:Main.java
protected static Object[] createWrappedLine(String block, Paint paint, float spaceOffset, float maxWidth) { float cacheWidth = maxWidth; float origMaxWidth = maxWidth; String line = ""; for (String word : block.split("\\s")) { cacheWidth = paint.measureText(word); maxWidth -= cacheWidth;//from w w w . j a v a2s . com if (maxWidth <= 0) { return new Object[] { line, maxWidth + cacheWidth + spaceOffset }; } line += word + " "; maxWidth -= spaceOffset; } if (paint.measureText(block) <= origMaxWidth) { return new Object[] { block, Float.MIN_VALUE }; } return new Object[] { line, maxWidth }; }