Write code to Convert a string to its plural form.
//package com.book2s; public class Main { /**/*from w w w .j a v a2 s. com*/ * Convert a string to its plural form. * * @param string the string to pluralize. * @return the pluralized string. */ public static String pluralize(String string) { char lastCharacter = string.charAt(string.length() - 1); if (lastCharacter == 's') return string + "es"; if (lastCharacter == 'y') { String start = string.substring(0, string.length() - 1); return start + "ies"; } return string + "s"; } }