public static int size(String str){
  if (str == null)   return 0;
  int length=str.length();
  int size=length;
  try {
    size=str.getBytes("UTF-8").length;
  }
 catch (  UnsupportedEncodingException e) {
    log.log(Level.SEVERE,str,e);
  }
  return size;
}

public static int size ( String str ) { if ( str == null ) return 0 ; int length = str . length ( ) ; int size = length ; try { size = str . getBytes ( "UTF-8" ) . length ; } catch ( UnsupportedEncodingException e ) { log . log ( Level . SEVERE , str , e ) ; } return size ; }
size of string in bytes
