Java Short Number Create toShort(String value)

Here you can find the source of toShort(String value)

Description

to Short

License

Open Source License

Declaration

public static Short toShort(String value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static Short toShort(String value) {
        if (null == value) {
            return null;
        }/*  w w w. j a  v  a  2s.  co  m*/
        value = value.trim();
        if ("null".equals(value)) {
            return null;
        }
        Double d = Double.parseDouble(value);
        return d.shortValue();
    }

    public static Short toShort(Object value) {
        return toShort(String.valueOf(value));
    }
}

Related

  1. toShort(String str)
  2. toShort(String str, int maxLen)
  3. toShort(String str, short defaultValue)
  4. toShort(String value)
  5. toShort(String value)
  6. toShort(String value, short defaultValue)
  7. toShort(String[] arr)