Example usage for org.apache.commons.lang3.text StrBuilder ensureCapacity

List of usage examples for org.apache.commons.lang3.text StrBuilder ensureCapacity

Introduction

In this page you can find the example usage for org.apache.commons.lang3.text StrBuilder ensureCapacity.

Prototype

public StrBuilder ensureCapacity(final int capacity) 

Source Link

Document

Checks the capacity and ensures that it is at least the size specified.

Usage

From source file:blue.soundObject.Note.java

public String toString() {
    StrBuilder temp = new StrBuilder();

    int strSize = 1;

    for (int i = 0; i < fields.length; i++) {
        strSize += fields[i].length() + 1;
    }/* ww  w. j ava  2  s . co  m*/

    temp.ensureCapacity(strSize);

    temp.append("i");

    int size = fields.length;
    for (int i = 0; i < size; i++) {
        if (i == 2) {
            if (this.isTied) {
                temp.append("-");
            }
            temp.append(NumberUtilities.formatFloat(subjectiveDuration)).append("\t");
        } else {
            temp.append(fields[i]);

            if (i < size - 1) {
                temp.append("\t");
            }
        }
    }

    return temp.toString();
}