Here you can find the source of toShort(String input, short defaultValue)
public static short toShort(String input, short defaultValue)
//package com.java2s; //License from project: Apache License public class Main { public static short toShort(String input, short defaultValue) { try {//from ww w. jav a2 s. co m return Short.parseShort(input); } catch (Exception e) { return defaultValue; } } public static short toShort(String input, int radix, short defaultValue) { try { return Short.parseShort(input, radix); } catch (Exception e) { return defaultValue; } } }