Java - Write code to trim Trailing White Space from a StringBuilder

Requirements

Write code to trim Trailing White Space from a StringBuilder

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        StringBuilder innerBody = new StringBuilder();
        innerBody.append("abc  ");
        trimTrailingWhiteSpace(innerBody);
    }/*from  w  ww  . j a va 2 s. c  om*/

    /**
     * @param innerBody
     */
    public static void trimTrailingWhiteSpace(StringBuilder innerBody) {
        while (Character
                .isWhitespace(innerBody.charAt(innerBody.length() - 1))) {
            innerBody.deleteCharAt(innerBody.length() - 1);
        }
    }
}