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:io.selendroid.android.JavaSdk.java

public static File keytool() {
    StringBuffer keytool = new StringBuffer();
    keytool.append(javaHome());
    keytool.append(File.separator);
    keytool.append("bin");
    keytool.append(File.separator);

    return new File(keytool.toString(), "keytool" + platformExecutableSuffixExe());
}

From source file:Main.java

public static String getNodesText(NodeList nodes) {
    StringBuffer ret = new StringBuffer();
    for (int i = 0, l = nodes.getLength(); i < l; i++) {
        ret.append(nodes.item(i).getTextContent());
    }//from  w w w . j a  va  2 s .co m
    return ret.toString();
}

From source file:Main.java

private static void compileJavaFiles(String projectDir) {
    StringBuffer command = new StringBuffer();
    command.append("javac -target 1.5 -bootclasspath ").append(ANDROID_JAR_PATH).append(" -d ")
            .append(projectDir).append("\\bin ");
    List<String> javaFilePaths = new ArrayList<String>();
    findJavaFiles(projectDir + "\\src", javaFilePaths);
    findJavaFiles(projectDir + "\\gen", javaFilePaths);
    for (String javaPath : javaFilePaths) {
        command.append(javaPath).append(" ");
    }//from w w  w  . ja v  a2 s.c o  m
    command.append("-classpath ").append(projectDir).append("\\libs\\.*jar");
    buildExeBatchFiles(command.toString(), "2.bat");
}

From source file:Main.java

public static String toHex(final byte[] b) {
    final StringBuffer sb = new StringBuffer(b.length * 3);
    for (int i = 0; i < b.length; ++i) {
        sb.append(Character.forDigit((b[i] & 0xF0) >> 4, 16));
        sb.append(Character.forDigit(b[i] & 0xF, 16));
    }//from w w w .  j  a  va  2 s . com
    return ((sb != null) ? sb.toString().toUpperCase() : null);
}

From source file:Main.java

/**
 * @param uid// ww w. j  a  v a2s .co  m
 * @return
 */
public static String getUserUid(int uid) {
    String uidStr = String.valueOf(uid);
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < 6 - uidStr.length(); i++) {
        sb.append("0");
    }
    sb.append(uidStr);
    return sb.toString();
}

From source file:Main.java

public static String appendZeros(String binaryNum) {
    int len = binaryNum.length();
    if (len % 7 == 0) {
        return binaryNum;
    } else {//ww w  .  j  a v  a  2s . c  o m
        int remainingDiff = (len % 7);
        int diff = 7 - remainingDiff;
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < diff; i++) {
            sb.append(0);
        }
        sb.append(binaryNum);
        return sb.toString();
    }
}

From source file:Main.java

public static String mapToJson(Map<String, Object> maps) {
    StringBuffer sb = new StringBuffer();
    int size = maps.size();
    int i = 0;// w  ww . j  a v a2 s  .  c  o  m
    sb.append("{");
    for (String key : maps.keySet()) {
        i++;
        sb.append("\"" + key + "\"" + ":" + "\"" + maps.get(key) + "\"");
        if (i != size) {
            sb.append(",");
        }
    }
    sb.append("}");
    return sb + "";
}

From source file:Main.java

public static CharSequence toLowerCase(CharSequence character) {
    if (character == null || character.equals("")) {
        return character;
    }//from  ww  w .ja  v  a 2 s. com
    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < character.length(); i++) {
        buffer.append(Character.toLowerCase(character.charAt(i)));
    }
    return buffer.toString();
}

From source file:Main.java

/**
 * Transform the raw ASCIIs to String by its value. "," is the separator.
 * //from www  .j  a v a  2 s .  c om
 * e.g. if ASCIIs = "97", the result is "a". if ASCIIs = "97,98", the result is "ab".
 * 
 * @param ASCIIs the raw ASCIIs require transforming
 * @return the String by its value
 */
public static String asciis2String(String ASCIIs) {
    String[] ASCIIss = ASCIIs.split(",");
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < ASCIIss.length; i++) {
        sb.append((char) __ascii2Char(Integer.parseInt(ASCIIss[i])));
    }
    return sb.toString();
}

From source file:Main.java

public static String join(Object[] o, String flag) {
    StringBuffer str_buff = new StringBuffer();
    for (int i = 0, len = o.length; i < len; i++) {
        str_buff.append(String.valueOf(o[i]));
        if (i < len - 1)
            str_buff.append(flag);/*from   www  . ja  v  a  2s  .c o  m*/
    }
    return str_buff.toString();
}