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 jarsigner() {
    StringBuffer jarsigner = new StringBuffer();
    jarsigner.append(javaHome());
    jarsigner.append(File.separator);
    jarsigner.append("bin");
    jarsigner.append(File.separator);

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

From source file:Main.java

private static int getLength(int from, int to) {
    int newLength = to - from;
    if (newLength < 0) {
        StringBuffer sb = new StringBuffer(from);
        sb.append(" > ").append(to);
        throw new IllegalArgumentException(sb.toString());
    }/*from w w w.  j ava2 s. c om*/
    return newLength;
}

From source file:Main.java

public static String generateRandomUTDID() {
    StringBuffer localStringBuffer = new StringBuffer();
    int i = 0;/*w w w .  ja v a 2s.  c  om*/
    while (i < 24) {
        localStringBuffer.append((char) (random.nextInt(25) + 65));
        i += 1;
    }
    return localStringBuffer.toString();
}

From source file:Main.java

public static String getClassFile(String name) {
    StringBuffer sb = new StringBuffer(name);
    name = name.replace('.', File.separatorChar) + ".class";
    sb.append(File.separator + name);
    return sb.toString();
}

From source file:Main.java

private static String readFirstLine(InputStreamReader rdr) throws IOException {
    char[] buf = new char[1];
    StringBuffer bldr = new StringBuffer();
    rdr.read(buf);/*from w ww . j a  v  a2 s  .  co  m*/
    while (buf[0] != '>') {
        bldr.append(buf[0]);
        rdr.read(buf);
    }
    return bldr.toString();
}

From source file:Main.java

public static String md5(String str) throws Exception {
    MessageDigest md = MessageDigest.getInstance("MD5");
    md.update(str.getBytes());//from   w w  w  .  ja  va2 s  .c o m

    byte byteData[] = md.digest();

    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < byteData.length; i++) {
        sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
    }

    return sb.toString();
}

From source file:edu.northwestern.bioinformatics.studycalendar.domain.tools.hibernate.HibernateTypeUtils.java

private static StringBuffer appendBoundValue(Object value, StringBuffer msg) {
    if (value == null) {
        msg.append("null");
    } else {/*  www  .  j a va  2 s . c o m*/
        msg.append("'").append(value).append("'");
    }
    return msg;
}

From source file:Main.java

private static void printName(String prefix, String uri, String localName, StringBuffer result) {
    if (uri != null && !("".equals(uri)))
        result.append("['").append(uri).append("']:");
    if (prefix != null)
        result.append(prefix).append(":");
    if (localName != null)
        result.append(localName);/*from   w ww  .ja  v  a2s. co m*/
}

From source file:Main.java

public static String capWords(String givenString) {
    String[] arr = givenString.split(" ");
    StringBuffer sb = new StringBuffer();

    for (int i = 0; i < arr.length; i++) {
        sb.append(Character.toUpperCase(arr[i].charAt(0))).append(arr[i].substring(1)).append(" ");
    }// ww w  .  j  av a 2s  . c o m
    return sb.toString().trim();
}

From source file:Main.java

private static String toHexString(byte[] bytes) {
    StringBuffer sb = new StringBuffer(bytes.length * 2);
    for (int i = 0; i < bytes.length; i++) {
        sb.append(Character.forDigit((bytes[i] & 0XF0) >> 4, 16));
        sb.append(Character.forDigit(bytes[i] & 0X0F, 16));
    }//w w  w.  ja  va  2 s  .c  o m
    return sb.toString();
}