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 void main(String[] argv) {
    StringBuffer sb = new StringBuffer();
    sb.append("java2s.com");

    System.out.println(sb.length());

    System.out.println(sb.capacity());
}

From source file:MainClass.java

public static void main(String args[]) {
    StringBuffer sb = new StringBuffer(40);
    sb.append(5);
    String s = sb.toString();/*w w w.j  av a2s  .c  om*/
    System.out.println(s);
}

From source file:Main.java

public static void main(String[] argv) {
    StringBuffer sb = new StringBuffer();
    sb.append("java2s.com");

    System.out.println(sb.length());
    System.out.println(sb.capacity());

    sb.trimToSize();//from  w w w.  j  av  a 2s .c  o  m

    System.out.println(sb.length());
    System.out.println(sb.capacity());

}

From source file:MainClass.java

public static void main(String args[]) {
    StringBuffer sb1 = new StringBuffer("abcde");
    sb1.append("abcdefghij");
    StringBuffer sb2 = sb1.reverse();
    System.out.println(sb1);//from   www  .j  a  v a2  s  .  co  m
    System.out.println(sb2);
}

From source file:MainClass.java

public static void main(String[] arg) {
    StringBuffer proverb = new StringBuffer(); // Capacity is 16
    proverb.append("A").append("B").append("C").append("D").append("E");

    System.out.println(proverb);/*  w  w w . j a v  a2  s  . c  om*/
}

From source file:Main.java

public static void main(String[] arg) {

    StringBuffer buffer = new StringBuffer("from java2s.com");

    buffer.append(buffer);

    System.out.println(buffer);/*from   w w  w . j ava 2  s .  c o  m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a manifest from a file
    InputStream fis = new FileInputStream("manifestfile");
    Manifest manifest = new Manifest(fis);

    // Construct a string version of a manifest
    StringBuffer sbuf = new StringBuffer();
    sbuf.append("Manifest-Version: 1.0\n");
    sbuf.append("\n");
    sbuf.append("Name: javax/swing/JScrollPane.class\n");
    sbuf.append("Java-Bean: True\n");

    // Convert the string to a input stream
    InputStream is = new ByteArrayInputStream(sbuf.toString().getBytes("UTF-8"));

    // Create the manifest
    manifest = new Manifest(is);
}

From source file:MainClass.java

public static void main(String[] arg) {
    StringBuffer newString = new StringBuffer("abcde1234567890");

    newString.append("saves nine");

    System.out.println(newString);

}

From source file:Main.java

public static void main(String[] arg) {

    StringBuffer buffer = new StringBuffer();

    int i = 123;//from   w  ww .ja  va  2  s . co m
    buffer.append(i);

    System.out.println(buffer);
}

From source file:Main.java

public static void main(String[] arg) {

    StringBuffer buffer = new StringBuffer();
    float f = 123.45F;
    buffer.append(f);
    System.out.println(buffer);/*from   ww  w  . j  a  va 2  s  .c o  m*/
}