Java Long to Short longToShort(long l)

Here you can find the source of longToShort(long l)

Description

long To Short

License

LGPL

Declaration

public static Short longToShort(long l) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static Short longToShort(long l) {
        if (l >= Short.MIN_VALUE && l <= Short.MAX_VALUE) {
            return (short) l;
        }//from   ww  w. j a  v a2s  .  co m
        return null;
    }

    public static short longToShort(long l, short defaultValue) {
        if (l >= Short.MIN_VALUE && l <= Short.MAX_VALUE) {
            return (short) l;
        }
        return defaultValue;
    }
}

Related

  1. Long2Short(long i)
  2. long2short(long l)
  3. long2short(long l)
  4. longToShort(final long value)
  5. longToShort(long[] values)
  6. longToShortBounds(long value)
  7. longToShorts(long n)
  8. longToShorts(long value)