public static final String removeMultipleSpacesAndReturns(final String data){
  final StringBuilder all_data=new StringBuilder(data);
  int i=1;
  while (i < all_data.length()) {
    if (((all_data.charAt(i) == ' ') && (all_data.charAt(i - 1) == ' ')) || ((all_data.charAt(i) == Character.LINE_SEPARATOR) && (all_data.charAt(i - 1) == Character.LINE_SEPARATOR))) {
      all_data.deleteCharAt(i);
    }
 else {
      i++;
    }
  }
  return all_data.toString();
}

public static final String removeMultipleSpacesAndReturns ( final String data ) { final StringBuilder all_data = new StringBuilder ( data ) ; int i = 1 ; while ( i < all_data . length ( ) ) { if ( ( ( all_data . charAt ( i ) == ' ' ) && ( all_data . charAt ( i - 1 ) == ' ' ) ) || ( ( all_data . charAt ( i ) == Character . LINE_SEPARATOR ) && ( all_data . charAt ( i - 1 ) == Character . LINE_SEPARATOR ) ) ) { all_data . deleteCharAt ( i ) ; } else { i ++ ; } } return all_data . toString ( ) ; }
remove multiple spaces and returns so just single value if multiples together - if it fails will just return data
