Java Utililty Methods Double to

List of utility methods to do Double to

Description

The list of methods to do Double to are organized into topic(s).

Method

StringdoubleToSexagesimal(double value, int precision, double hopr, double lopr)
double To Sexagesimal
double prec_frac, range, hrs, frac;
int i, min, sec;
if (precision == UNSET_PRECISION) {
    precision = DEFAULT_PRECISION;
if (precision <= MAXPREC) {
    prec_frac = prec_tab[precision];
} else {
...
StringdoubleToSingleQuote(String source)
replace " with '
if (source == null || source.trim().length() == 0)
    return "";
if (source.indexOf("\"") != -1) {
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < source.length(); i++) {
        char c = source.charAt(i);
        if (c != '\"') {
            buf.append(c);
...
StringdoubleToSingleQuotes(String str)
double To Single Quotes
return str.replaceAll("'", "\\'").replaceAll("\"", "'");
intdoubleToSlider(final double min, final double max, final double value)
Converts the double value to a slider selection.
int val = (int) Math.round((value - min) / (max - min) * SLIDER_MAX);
if (val < 0) {
    val = 0;
if (val > SLIDER_MAX) {
    val = SLIDER_MAX;
return val;
...
StringdoubleToTime(double time)
Convert double time to string.
int ms = (int) (time * 1000 % 1000);
int s = (int) (time % 60);
int min = (int) (time / 60);
return min + ":" + String.format("%02d", s) + ":" + String.format("%03d", ms);
char[]doubleToUnary(int max, double num)
double To Unary
char[] chars = new char[max];
int discrNum = (int) num;
for (int i = 0; i <= num; ++i) {
    chars[i] = '1';
for (int i = discrNum + 1; i < max; ++i) {
    chars[i] = '0';
return chars;