Java Integer Array Convert To intsToLong(int highBits, int lowBits)

Here you can find the source of intsToLong(int highBits, int lowBits)

Description

Takes two int and smooshes them into a long.

License

Apache License

Parameter

Parameter Description
highBits a parameter
lowBits a parameter

Declaration

public static final long intsToLong(int highBits, int lowBits) 

Method Source Code

//package com.java2s;
/*//  ww  w.  jav a  2 s.  co  m
Copyright 2007 Brian Tanner
brian@tannerpages.com
http://brian.tannerpages.com
    
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
    
 http://www.apache.org/licenses/LICENSE-2.0
    
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
*/

public class Main {
    /**
     * Takes two int and smooshes them into a long.
     * 
     * @param highBits
     * @param lowBits
     */
    public static final long intsToLong(int highBits, int lowBits) {
        long newLong = (4294967295L & (long) lowBits) | (long) highBits << 32;
        return newLong;
    }
}

Related

  1. intsToBytes(int[] intArray)
  2. intsToBytes(int[][] ints)
  3. intsToCommaSeparatedString(int[] ints)
  4. intsToHex(int[] val)
  5. intsToIntegers(int... ints)
  6. intsToLong(int off, int... arr)
  7. intsToLongs(int... ints)
  8. intsToUnsignedBytes(int[] sprite)