public static void main(String[] args){
String str = "您的回答被采纳后将获得系统奖励";
byte[] b = getBytes(str);
if(b!=null){
//......
}
}
public byte[] getBytes(String str){
if(StringUtils.isNotBlank(str)){
try {
return str.trim().getBytes("UTF-8");
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
}
}
return null;
}