public static String checkSize ( Object value , int limitSize , String defaultValue ) { if ( value != null ) { if ( byte [ ] . class . getSimpleName ( ) . equals ( value . getClass ( ) . getSimpleName ( ) ) ) { return checkSize ( ( byte [ ] ) value , limitSize / 2 ) ; } String str = value . toString ( ) ; if ( str . length ( ) > limitSize ) { return str . substring ( 0 , limitSize - 3 ) + "..." ; } else return str ; } else return defaultValue ; }
limit string size .