public static int findBeforeNewLineChar(CharSequence s,int start){
  for (int i=start - 1; i > 0; i--) {
    if (s.charAt(i) == '\n') {
      return i;
    }
  }
  return -1;
}

public static int findBeforeNewLineChar ( CharSequence s , int start ) { for ( int i = start - 1 ; i > 0 ; i -- ) { if ( s . charAt ( i ) == '\n' ) { return i ; } } return - 1 ; }
find ' \ n ' before " start " position
