Example usage for java.lang Boolean toString

List of usage examples for java.lang Boolean toString

Introduction

In this page you can find the example usage for java.lang Boolean toString.

Prototype

public static String toString(boolean b) 

Source Link

Document

Returns a String object representing the specified boolean.

Usage

From source file:Main.java

public static Bitmap createResizedBitmap(Bitmap srcBit, int newWidth, int newHeight) {
    int width = srcBit.getWidth();
    int height = srcBit.getHeight();

    // calculate the scale - in this case = 0.4f
    float scaleWidth = ((float) newWidth) / width;
    float scaleHeight = ((float) newHeight) / height;

    Matrix matrix = new Matrix();
    matrix.postScale(scaleWidth, scaleHeight);
    Bitmap resizedBitmap = Bitmap.createBitmap(srcBit, 0, 0, width, height, matrix, true);

    width = resizedBitmap.getWidth();//from  w ww.  ja v a2 s .  c o m
    height = resizedBitmap.getHeight();

    Log.i("ImageResize",
            "Image Resize Result : " + Boolean.toString((newHeight == height) && (newWidth == width)));
    return resizedBitmap;
}

From source file:Main.java

/**
 * Sets an attribute on the specified element with the specified name if the specified
 * value is different from the specified default value.
 *
 * @param base//  w  ww .  j  a  v a  2s  .c o m
 *            the Element to set the attribute on
 * @param name
 *            the attribute name
 * @param value
 *            the value that attribute should be set to
 * @param defaultValue
 *            the default value of the attribute
 */
public static void attributeBooleanSet(Element base, String name, boolean value, boolean defaultValue) {
    if (value != defaultValue) {
        base.setAttribute(name, Boolean.toString(value));
    }
}

From source file:Main.java

public static void writeBooleanAttribute(XmlSerializer out, String name, boolean value) throws IOException {
    out.attribute(null, name, Boolean.toString(value));
}

From source file:Main.java

/**
 * Convert to String a boolean value that received as parameter.
 *
 * @param bool the bool//  w  ww. j a va2  s. c o  m
 * @return String
 */
public static String toStringBoolean(Boolean bool) {
    return bool == null ? null : URLEncoder.encode(Boolean.toString(bool));
}

From source file:Main.java

public static void writeBoolAttr(Element element, String attributeName, boolean value) {
    element.setAttribute(attributeName, Boolean.toString(value));
}

From source file:Main.java

/**
 * Creates an element with the specified tag with the text as the boolean value
 * @param element - the element to add the created element to
 * @param tag - the tag name for the element to create
 * @param value - the value to have as the content of the created Element
 * @return The element created/*from  ww w  .ja v a 2s  .com*/
 */
public static Element appendTextElement(Element element, String tag, boolean value) {
    return appendTextElement(element, tag, Boolean.toString(value));
}

From source file:com.twinsoft.convertigo.engine.util.CookiesUtils.java

public static String formatCookie(Cookie cookie) {
    StringBuffer buf = new StringBuffer();
    Date d = cookie.getExpiryDate();
    String[][] datas = {//  w ww. j a v  a 2s  . c om
            // {"$Version",Integer.toString(cookie.getVersion())},
            { cookie.getName(), cookie.getValue() }, { "$Domain", cookie.getDomain() },
            { "$Path", cookie.getPath() }, { "$Secure", Boolean.toString(cookie.getSecure()) },
            { "$Date", d == null ? "null" : DateFormat.getDateTimeInstance().format(d) } };
    buf.append(datas[0][0] + "=" + datas[0][1]);
    for (int i = 1; i < datas.length; i++) {
        if (datas[i][1] != null)
            buf.append("; " + datas[i][0] + "=" + datas[i][1]);
    }
    return buf.toString();
}

From source file:MainClass.java

protected void configureShell(Shell shell) {
    super.configureShell(shell);
    shell.setText("Send Message");
    shell.setSize(500, 400);/*from   w  w w .ja  v  a2  s  .c  o  m*/

    boolean b = MessageDialog.openConfirm(shell, "Confirm", "info");
    System.out.println("Returned " + Boolean.toString(b));
    MessageDialog.openError(shell, "Error", "info");
    System.out.println("Returned void");

    MessageDialog.openInformation(shell, "Information", "info");
    System.out.println("Returned void");

    b = MessageDialog.openQuestion(shell, "Question", "info");
    System.out.println("Returned " + Boolean.toString(b));

    MessageDialog.openWarning(shell, "Warning", "info");
    System.out.println("Returned void");

}

From source file:Main.java

/**
 * Gets a boolean attribute from a {@code Map<String, Set<String>>}, defaulting to the given default value if
 * the attribute is not present.// www  .j a  v a2  s. com
 *
 * @param map the attribute map.
 * @param name the name of the attribute to retrieve.
 * @param defaultValue the value to use if the attribute is not present.
 * @return the boolean value using {@link Boolean#parseBoolean(String)}.
 */
public static boolean getBooleanMapAttr(Map map, String name, boolean defaultValue) {
    String value = getMapAttr(map, name, Boolean.toString(defaultValue));
    return Boolean.parseBoolean(value);
}

From source file:cn.ctyun.amazonaws.util.StringUtils.java

public static String fromBoolean(Boolean value) {
    return Boolean.toString(value);
}