private static String[] makeUtf8Able(String s){
  if (s.length() < (65536 / 3))   return new String[]{s};
  int sLength=s.length(), utfLength=0;
  int from=0;
  List<String> l=new ArrayList<String>();
  for (int i=0; ; i++) {
    if (i == sLength) {
      l.add(s.substring(from));
      break;
    }
    if (utfLength >= 65532) {
      l.add(s.substring(from,i));
      if (i + (65536 / 3) > sLength) {
        l.add(s.substring(i));
        break;
      }
      from=i;
      utfLength=0;
    }
    int c=s.charAt(i);
    if (c >= 0x0001 && c <= 0x007F) {
      ++utfLength;
    }
 else     if (c > 0x07FF) {
      utfLength+=3;
    }
 else {
      utfLength+=2;
    }
  }
  return (String[])l.toArray(new String[l.size()]);
}

private static String [ ] makeUtf8Able ( String s ) { if ( s . length ( ) < ( 65536 / 3 ) ) return new String [ ] { s } ; int sLength = s . length ( ) , utfLength = 0 ; int from = 0 ; List < String > l = new ArrayList < String > ( ) ; for ( int i = 0 ; ; i ++ ) { if ( i == sLength ) { l . add ( s . substring ( from ) ) ; break ; } if ( utfLength >= 65532 ) { l . add ( s . substring ( from , i ) ) ; if ( i + ( 65536 / 3 ) > sLength ) { l . add ( s . substring ( i ) ) ; break ; } from = i ; utfLength = 0 ; } int c = s . charAt ( i ) ; if ( c >= 0x0001 && c <= 0x007F ) { ++ utfLength ; } else if ( c > 0x07FF ) { utfLength += 3 ; } else { utfLength += 2 ; } } return ( String [ ] ) l . toArray ( new String [ l . size ( ) ] ) ; }
only strings that can be utf8 - encoded into 65535 bytes can be stored as a constant string info .
