Here you can find the source of lengthByteInPrepared(String s)
public static int lengthByteInPrepared(String s)
//package com.java2s; //License from project: Apache License public class Main { public static int lengthByteInPrepared(String s) { int length = 0; if (s == null) { return length; }//from ww w. j a v a 2 s . c o m for (int i = 0; i < s.length(); i++) { if (s.charAt(i) <= 127) { length++; } else { length = length + 3; } } return length; } }