Here you can find the source of shortenString(String orig, int maxLength)
public static String shortenString(String orig, int maxLength)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file public class Main { public static String shortenString(String orig, int maxLength) { if (orig == null || orig.length() <= maxLength) { return orig; }//ww w . j a va2s . c o m return orig.substring(0, maxLength); } }