Java remove line breaks in string

Java remove line breaks in string
‮t refer‬o:lautturi.com
/**
 * @author lautturi.com 
 * Java example: remove new line in java string
 */


import java.util.*;
import java.util.regex.*;

public class Lautturi {

	public static void main(String[] args) {
		String text = "hello \r\n java \n hi lautturi";
		text = text.replaceAll("\r", " ");
		text = text.replaceAll("\n", " ");
		System.out.println(text);

	}
}

output:

hello    java   hi lautturi
Created Time:2017-10-07 15:27:03  Author:lautturi