Example usage for java.lang StringBuffer toString

List of usage examples for java.lang StringBuffer toString

Introduction

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

Prototype

@Override
    @HotSpotIntrinsicCandidate
    public synchronized String toString() 

Source Link

Usage

From source file:Main.java

public static String numToK(int number) {
    if (number < 10000) {
        return String.valueOf(number);
    } else {//from   w  w  w  .j a v  a2  s  .  co m
        float value = number * 1.0f / 10000;
        StringBuffer sb = new StringBuffer(String.valueOf(value));
        sb.append("K");
        return sb.toString();
    }
}

From source file:Main.java

public static String generateGroupID(String title, String date) {
    start++;/*  w  w w.  j  a v a2  s  .  c om*/
    StringBuffer result = new StringBuffer();
    result.append(title).append(date).append(start);
    return result.toString();
}

From source file:Main.java

public static String generatePostID(String title, String date) {
    start++;//from  ww  w  .ja v  a  2 s  . c  o  m
    StringBuffer result = new StringBuffer();
    result.append(title).append(date).append(start);
    return result.toString();
}

From source file:Main.java

public static String generateCommentID(String title, String date) {
    start++;//from   w  ww . ja  va  2  s .  c o m
    StringBuffer result = new StringBuffer();
    result.append(title).append(date).append(start);
    return result.toString();
}

From source file:Main.java

public static void printStackTrace(final StackTraceElement[] stack, PrintStream out) {
    final StringBuffer b = new StringBuffer();
    printStackTrace(stack, b);//from w  w w . j a v  a 2 s.co m
    out.print(b.toString());
}

From source file:Main.java

public static String formatTo2Bit(int num) {

    if (num < 10) {

        StringBuffer sb;

        sb = new StringBuffer("0");
        sb.append(num);//  ww w .  j av  a2s.c o m

        return sb.toString();
    } else {

        return String.valueOf(num);
    }
}

From source file:Main.java

public static String buffer(String... array) {
    StringBuffer s = new StringBuffer();
    for (String str : array) {
        s.append(str);//  w w w. jav  a 2 s .  co m
    }
    return s.toString();
}

From source file:Main.java

private static String convertToHex(byte[] paramArrayOfByte) {
    StringBuffer localStringBuffer = new StringBuffer();
    int i = paramArrayOfByte.length;
    int j = 0;//from w  w w. jav a 2s.  c  om
    return localStringBuffer.toString();
}

From source file:Main.java

static String HexForBytes(byte[] bytes) {
    StringBuffer sb = new StringBuffer();
    for (byte b : bytes)
        sb.append(HexForByte(b));//from  ww w .j  a  v  a  2  s .  c  o m
    return sb.toString();
}

From source file:Main.java

public static String appendPercentSymbol(int percent) {

    StringBuffer sb;

    sb = new StringBuffer();
    sb.append(percent);/*from   w  w w. j a  va 2s .  co  m*/
    sb.append("%");

    return sb.toString();
}