Example usage for java.lang StringBuilder append

List of usage examples for java.lang StringBuilder append

Introduction

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

Prototype

@Override
    public StringBuilder append(double d) 

Source Link

Usage

From source file:Main.java

public static String KJencrypt(String str) {
    char[] cstr = str.toCharArray();
    StringBuilder hex = new StringBuilder();
    for (char c : cstr) {
        hex.append((char) (c + 5));
    }//  w  ww  .j  a  va 2s . c  o  m
    return hex.toString();
}

From source file:Main.java

private static final void appendAttribute(StringBuilder sb, String name, Object value) {
    //i.e. '  vendor="sap.com"'
    sb.append(" ").append(name).append("=\"").append(value).append("\"");
}

From source file:Main.java

public static String KJdecipher(String str) {
    char[] cstr = str.toCharArray();
    StringBuilder hex = new StringBuilder();
    for (char c : cstr) {
        hex.append((char) (c - 5));
    }/*w  w  w  .  j a  v  a 2s.c  o m*/
    return hex.toString();
}

From source file:Main.java

public static String getVideo2gifCommand(long start, long length, int frame, String sourcePath, String outPath,
        int width, int height) {
    StringBuilder command = new StringBuilder("-ss ");
    command.append(start);
    command.append(" -t ");
    command.append(length);/*from   w  w  w  .jav  a 2  s .c om*/
    command.append(" -i ");
    command.append(sourcePath);
    command.append(" -s ");
    command.append(width + "x" + height);
    command.append(" -f ");
    command.append("gif");
    command.append(" -r ");
    command.append(frame);
    command.append(" ");
    command.append(outPath);
    Log.i("broncho", "command = " + command.toString());
    return command.toString();
}

From source file:Main.java

public static <T> String array2String(T... array) {
    int len = array.length;
    if (len == 0) {
        return "";
    }/*www.ja va  2 s .  co  m*/

    StringBuilder sb = new StringBuilder();
    sb.append("[").append(array[0]);
    for (int i = 1; i < array.length; i++) {
        sb.append(",").append(array[i]);
    }
    sb.append("]");

    return sb.toString();
}

From source file:Main.java

public static String getThrows(ExecutableElement d) {
    Collection<? extends TypeMirror> params = d.getThrownTypes();
    if (params.size() == 0)
        return "";
    StringBuilder sbuf = new StringBuilder(params.size() * 20);
    sbuf.append("throws ");
    for (TypeMirror param : params) {
        sbuf.append(param.toString());/*from w w w  .j a v  a2  s  .  co  m*/
        sbuf.append(',');
    }
    sbuf.setLength(sbuf.length() - 1);
    return sbuf.toString();
}

From source file:Main.java

public static String getHumanReadableTime(long ms) {
    final long days = TimeUnit.MILLISECONDS.toDays(ms);
    ms -= TimeUnit.DAYS.toMillis(days);
    final long hours = TimeUnit.MILLISECONDS.toHours(ms);
    ms -= TimeUnit.HOURS.toMillis(hours);
    final long minutes = TimeUnit.MILLISECONDS.toMinutes(ms);
    ms -= TimeUnit.MINUTES.toMillis(minutes);
    final long seconds = TimeUnit.MILLISECONDS.toSeconds(ms);

    final StringBuilder sb = new StringBuilder();
    sb.append(days);
    sb.append("d ");
    sb.append(hours);/*from  ww w  . ja v  a  2 s  . c  o m*/
    sb.append("h ");
    sb.append(minutes);
    sb.append("m ");
    sb.append(seconds);
    sb.append('s');

    return (sb.toString());
}

From source file:Main.java

public static String bytesToAddress(byte[] bytes) {
    StringBuilder sb = new StringBuilder();
    for (byte b : bytes) {
        sb.append(String.format("%02X:", b));
    }//  ww w.j  av a 2s  . c o m
    sb.deleteCharAt(sb.length() - 1); // remove last semicolon
    return sb.toString();
}

From source file:Main.java

public static <T> String join(T[] array, String join) {
    StringBuilder builder = new StringBuilder();
    for (T t : array) {
        builder.append(t);
        builder.append(join);/*from   ww  w .  j  a  va  2 s  .  c o  m*/
    }
    return builder.deleteCharAt(builder.length() - 1).toString();
}

From source file:Main.java

public static String builder(String... array) {
    StringBuilder s = new StringBuilder();
    for (String str : array) {
        s.append(str);
    }/*from w  w  w .jav  a2s.co m*/
    return s.toString();
}