Java Number Value Of valueOf(boolean flag)

Here you can find the source of valueOf(boolean flag)

Description

value Of

License

Open Source License

Declaration

public static String valueOf(boolean flag) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String valueOf(char c) {
        char ac[] = new char[1];
        ac[0] = c;//from w w  w . ja v  a 2  s.c  om
        return new String(ac);
    }

    public static String valueOf(double d) {
        return Double.toString(d);
    }

    public static String valueOf(float f) {
        return Float.toString(f);
    }

    public static String valueOf(int i) {
        char ac[] = new char[11];
        int j = ac.length;
        boolean flag = i < 0;
        if (!flag)
            i = -i;
        for (; i <= -10; i /= 10)
            ac[--j] = Character.forDigit(-(i % 10), 10);

        ac[--j] = Character.forDigit(-i, 10);
        if (flag)
            ac[--j] = '-';
        return new String(ac, j, ac.length - j);
    }

    public static String valueOf(long l) {
        return Long.toString(l, 10);
    }

    public static String valueOf(Object obj) {
        return obj != null ? obj.toString() : "";
    }

    public static String valueOf(boolean flag) {
        return flag ? "true" : "false";
    }

    public static String valueOf(char ac[]) {
        return new String(ac);
    }
}

Related

  1. valueOf(Boolean b)
  2. valueOf(boolean b)
  3. valueOf(boolean b)
  4. valueOf(Boolean bool)
  5. valueOf(boolean tmp)
  6. valueOf(Boolean value)
  7. valueOf(Boolean value)
  8. valueOf(char c)