List of usage examples for java.lang Math min
@HotSpotIntrinsicCandidate public static double min(double a, double b)
From source file:Main.java
public static float clamp(float value, float max, float min) { return Math.max(Math.min(value, min), max); }
From source file:Main.java
public static int adjust(final int value, final int min, final int max) { return Math.min(Math.max(min, value), max); }
From source file:Main.java
public static float getBalance(int h, int w, float height, float width) { return Math.min(h / height, w / width); }
From source file:Main.java
public static Float getFloat(float value, float minValue, float maxValue) { return Math.min(maxValue, Math.max(minValue, value)); }
From source file:Main.java
public static double boundaryRestrict(double f, double e, double d) { return Math.max(Math.min(f, d), e); }
From source file:Main.java
public static String byteArrayToString(byte[] value, int length) { int max = Math.min(length, value.length); StringBuilder stringBuilder = new StringBuilder(""); for (int i = 0; i < max; i++) { stringBuilder.append((char) value[i]); }//from w w w . ja v a2 s. c o m return stringBuilder.toString(); }
From source file:Main.java
public static int clamp(final int num, final int max, final int min) { return Math.max(Math.min(num, max), min); }
From source file:Main.java
private static int getSizeBaseScore(int i, int j, android.hardware.Camera.Size size) { return Math.min(size.height - j, 0) + Math.min(size.width - i, 0); }
From source file:Main.java
public static int neighbors(int[][] source, int x, int y) { int maxX = Math.min(source[0].length - 1, x + 1); int maxY = Math.min(source.length - 1, y + 1); int counter = 0; for (int i = Math.max(y - 1, 0); i <= maxY; i++) { for (int j = Math.max(x - 1, 0); j <= maxX; j++) { if (j != x || i != y) { counter += source[i][j]; }/*from w w w. j a v a 2 s . c o m*/ } } return counter; }
From source file:Main.java
public static int getMinWidth(Activity act) { return Math.min(getDisplayWidth(act), getDisplayHeight(act)); }