Java Long to Int long2Int(final long v)

Here you can find the source of long2Int(final long v)

Description

long Int

License

Open Source License

Declaration

static int long2Int(final long v) 

Method Source Code

//package com.java2s;

public class Main {
    static final long MAX_INT_VALUE = (Integer.MAX_VALUE & 0xffffffffL);

    static int long2Int(final long v) {
        if (MAX_INT_VALUE < v) {
            throw new IllegalArgumentException(
                    "Read uint32 value " + toHexString(v) + " > int32-max " + toHexString(MAX_INT_VALUE));
        }//from www  .  java 2  s. c  om
        return (int) v;
    }

    static String toHexString(final int i) {
        return "0x" + Integer.toHexString(i);
    }

    static String toHexString(final long i) {
        return "0x" + Long.toHexString(i);
    }
}

Related

  1. long2int(final long l)
  2. long2int(final long l)
  3. long2int(final long l)
  4. long2int(final long[] a)
  5. Long2Int(long i)
  6. long2int(Long source)
  7. longToInt(final Long l, final String name, final int deflt)