List of utility methods to do Franction Convert
void | fraction(StringBuilder buf, int scale, long ms) fraction if (scale > 0) { buf.append('.'); long v1 = scale == 3 ? ms : scale == 2 ? ms / 10 : scale == 1 ? ms / 100 : 0; number(buf, (int) v1, scale); |
double | fractionAlongRay(double px, double py, double qx, double qy, double rx, double ry) Calculate the scalar such that when the length of the ray is multiplied by this scalar, it will provide the closest point along the ray to the reference point. double sx = px - qx; double sy = py - qy; return dot(sx, sy, rx, ry) / dot(rx, ry, rx, ry); |
float | fractionalPart(float fnum) fractional Part int wholePart = wholePart(fnum); return fnum - wholePart; |
double | fractionalTime(int hour, int minute, int second) fractional Time return (double) hour / 24.0 + (double) minute / (24.0 * 60.0) + (double) second / (24.0 * 60.0 * 60.0); |
int | fractionDigits(double number) Returns the number of digits needed for displaying the postfix values of a number, but at most 7. double x = fraction(number); int n = 0; while (x >= 0.0000001 && n < 7) { n++; x = fraction(x * 10); return n; |
double | fractionOfStringUppercase(String input) Of the characters in the string that have an uppercase form, how many are uppercased? if (input == null) { return 0; double upperCasableCharacters = 0; double upperCount = 0; for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); char uc = Character.toUpperCase(c); ... |
double | fractionToDecimal(String fraction) Converts a String fraction into a double value. if (fraction == null || "".equals(fraction)) { throw new NumberFormatException("A null or empty String can not be converted to a fraction."); String[] split = fraction.split("/"); if (split.length == 1) { return Double.valueOf(fraction); } else if (split.length == 2) { String numerator = split[0]; ... |