Here you can find the source of rightTrim(String[] values)
public static String[] rightTrim(String[] values)
//package com.java2s; /**//from ww w. j a v a 2 s. c o m * Copyright (c) 2015 SK holdings Co., Ltd. All rights reserved. * This software is the confidential and proprietary information of SK holdings. * You shall not disclose such confidential information and shall use it only in * accordance with the terms of the license agreement you entered into with SK holdings. * (http://www.eclipse.org/legal/epl-v10.html) */ public class Main { public static String[] rightTrim(String[] values) { isNull(values); StringBuffer b = null; for (int j = 0; j < values.length; j++) { b = new StringBuffer(values[j]); for (int k = b.length() - 1; k >= 0; k--) { if (b.charAt(k) == ' ') { b.deleteCharAt(k); } else if (b.charAt(k) != ' ') { break; } } values[j] = b.toString(); } return values; } public static boolean isNull(String[] string) { if (string == null) { return true; } return false; } public static boolean isNull(Object object) { return (object == null); } }