remove white space at the end of string in java

remove white space at the end of string in java
refer to:‮iruttual‬.com
/**
 * @author lautturi.com 
 * Java example: removing white space at the end of string in java
 */


import java.util.*;

public class Lautturi {
	public static void main(String[] args) {

		String str = "  hello lau java 	\n  ";
		String newString = str.replaceAll("\\s+$","");
		System.out.println(newString);
	}
}

output:

,   hello lau java
Created Time:2017-10-07 17:46:33  Author:lautturi