Example usage for java.lang StringBuffer append

List of usage examples for java.lang StringBuffer append

Introduction

In this page you can find the example usage for java.lang StringBuffer append.

Prototype

@Override
    public synchronized StringBuffer append(double d) 

Source Link

Usage

From source file:Main.java

public static String listToString(List list) {
    StringBuffer sb = new StringBuffer();
    for (Object o : list) {
        sb.append(o.toString() + " ");
    }/*  www .ja va  2  s. co  m*/
    return sb.toString();
}

From source file:Main.java

public static String getMonthSelect(String selectName, String value, boolean hasBlank) {
    StringBuffer sb = new StringBuffer("");
    sb.append("<select name=\"" + selectName + "\">");
    if (hasBlank) {
        sb.append("<option value=\"\"></option>");
    }//from   w w w .  j  av a  2s  .  c  o  m
    for (int i = 1; i <= 12; i++) {
        if (!value.trim().equals("") && i == Integer.parseInt(value)) {
            sb.append("<option value=\"" + i + "\" selected>" + i + "</option>");
        } else {
            sb.append("<option value=\"" + i + "\">" + i + "</option>");
        }
    }
    sb.append("</select>");
    return sb.toString();
}

From source file:Main.java

public static String getMonthSelect(String selectName, String value, boolean hasBlank, String js) {
    StringBuffer sb = new StringBuffer("");
    sb.append("<select name=\"" + selectName + "\" " + js + ">");
    if (hasBlank) {
        sb.append("<option value=\"\"></option>");
    }//from  w  ww  . ja  v  a 2  s  .  c  o  m
    for (int i = 1; i <= 12; i++) {
        if (!value.trim().equals("") && i == Integer.parseInt(value)) {
            sb.append("<option value=\"" + i + "\" selected>" + i + "</option>");
        } else {
            sb.append("<option value=\"" + i + "\">" + i + "</option>");
        }
    }
    sb.append("</select>");
    return sb.toString();
}

From source file:Main.java

public static String ByteArrayToString(byte[] arr) {
    StringBuffer sb = new StringBuffer();
    for (byte item : arr) {
        sb.append(String.format("%02X ", item & 0xFF));
    }// ww w  .  j  av a2s  .c om

    return "{ " + sb.toString() + "}";
}

From source file:Main.java

@TargetApi(4)
public static String getCpuInfo() {
    StringBuffer sb = new StringBuffer();
    sb.append("abi: ").append(Build.CPU_ABI).append("\n");
    if (new File("/proc/cpuinfo").exists()) {
        try {/*from  w  w  w. j  a v a 2s .co m*/
            BufferedReader br = new BufferedReader(new FileReader(new File("/proc/cpuinfo")));
            String aLine;
            while ((aLine = br.readLine()) != null) {
                sb.append(aLine + "\n");
            }
            if (br != null) {
                br.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    return sb.toString();
}

From source file:Main.java

private static void buildUnsignedApk(String projectDir, String apkName) {
    StringBuffer command = new StringBuffer();
    command.append("java -cp ").append(SDK_LIB_JAR_PATH).append(" com.android.sdklib.build.ApkBuilderMain ")
            .append(projectDir).append("\\bin\\").append(apkName).append(" -v -u -z ").append(projectDir)
            .append("\\bin\\resources.ap_").append(" -f ").append(projectDir).append("\\bin\\classes.dex")
            .append(" -rf ").append(projectDir).append("\\src");
    buildExeBatchFiles(command.toString(), "5.bat");
}

From source file:Main.java

public static String buffer(String... array) {
    StringBuffer s = new StringBuffer();
    for (String str : array) {
        s.append(str);
    }//from   w  w  w  . j ava2 s .c  o m
    return s.toString();
}

From source file:Main.java

public static String makeDeviceID(byte[] bytes) {
    if (bytes.length < 12)
        return "";
    StringBuffer sb = new StringBuffer();
    for (byte b : bytes) {
        sb.append(Integer.toHexString((b & 0xFF) | 0xFFFFFF00).substring(6).toUpperCase());
    }//from   ww w .  j  av  a2s  .  com
    return sb.toString();
}

From source file:Main.java

/**
 * Builds a subflow-root id. The caller must append a segment id to form a
 * full offline id.//  www .j  a  va2 s.  c o m
 * 
 * @param p_tuIdAsStr
 *            the TU id of the target tuv.
 * @param m_parentOfSubTagName
 * @param p_delimter
 *            used to separate portions of the segments ID
 * @return the subflow root id as a string
 */
static public String makeSubSegIdPrefix(String p_tuId, String m_parentOfSubTagName, char p_delimiter) {
    StringBuffer sb = new StringBuffer();

    sb.append(p_tuId);
    if (m_parentOfSubTagName != null) {
        sb.append(p_delimiter);
        sb.append(m_parentOfSubTagName);
    }
    sb.append(p_delimiter);

    return sb.toString();
}

From source file:com.germinus.easyconf.ConfUtil.java

public static String toString(Configuration configuration) {
    Iterator it = configuration.getKeys();
    StringBuffer result = new StringBuffer();
    result.append("{");
    while (it.hasNext()) {
        String key = (String) it.next();
        result.append(key + "=" + configuration.getProperty(key));
        result.append(", ");
    }/* www . j av  a  2 s  .  com*/
    result.append("}");
    return result.toString();
}