Java Unsigned Number Create unsignedShortToInt(short n)

Here you can find the source of unsignedShortToInt(short n)

Description

Generate an integer from an unsigned short.

License

Open Source License

Parameter

Parameter Description
n the unsigned short.

Return

the integer representing the unsigned value.

Declaration

public static int unsignedShortToInt(short n) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Ericsson/* w w  w.ja v a  2s .  c o  m*/
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Vincent Perot - Initial API and implementation
 *******************************************************************************/

public class Main {
    /**
     * Generate an integer from an unsigned short.
     *
     * @param n
     *            the unsigned short.
     * @return the integer representing the unsigned value.
     */
    public static int unsignedShortToInt(short n) {
        return n & 0x0000FFFF;
    }
}

Related

  1. unsignedShort2Arr(int var, byte[] arrayBytes, int startIndex)
  2. unsignedShortAt(byte[] data, int pos)
  3. unsignedShortBytesToInt(byte[] b)
  4. unsignedShortToInt(byte[] b)
  5. unsignedShortToInt(final byte[] b)
  6. unsignedSubOverflow(int operand1, int operand2)
  7. unsignedToBytes(byte b)
  8. unsignedToSigned(int unsigned, int size)
  9. unsignedToSigned(int[] ints)