Java Short Number Create toShort(Object value)

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

Description

to Short

License

Open Source License

Declaration

public static final short toShort(Object value) 

Method Source Code

//package com.java2s;

public class Main {
    public static final short toShort(Object value) {
        if (value instanceof Number)
            return ((Number) value).shortValue();
        else if (value == null)
            return 0;
        else//from ww w. j  a v a 2 s.com
            return Short.parseShort(value.toString());
    }

    public static final String toString(Object value) {
        if (value == null)
            return null;

        return value.toString();
    }
}

Related

  1. toShort(Object obj)
  2. toShort(Object prmIntObject)
  3. toShort(Object value)
  4. toShort(Object value)
  5. toShort(Object value)
  6. toShort(Object value)
  7. toShort(String input, short defaultValue)
  8. toShort(String numeric)
  9. toShort(String str)