All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nimbusds.jose.util.IntegerUtils Maven / Gradle / Ivy

Go to download

Java library for Javascript Object Signing and Encryption (JOSE) and JSON Web Tokens (JWT)

There is a newer version: 9.48
Show newest version
package com.nimbusds.jose.util;


/**
 * Integer utilities.
 *
 * @author Vladimir Dzhuvinov
 * @version 2015-05-12
 */
public class IntegerUtils {


	/**
	 * Returns a four byte array representation of the specified integer.
	 *
	 * @param intValue The integer to be converted.
	 *
	 * @return The byte array representation of the integer.
	 */
	public static byte[] toBytes(int intValue) {

		byte[] res = new byte[4];
		res[0] = (byte) (intValue >>> 24);
		res[1] = (byte) ((intValue >>> 16) & 0xFF);
		res[2] = (byte) ((intValue >>> 8) & 0xFF);
		res[3] = (byte) (intValue & 0xFF);
		return res;
	}


	/**
	 * Prevents public instantiation.
	 */
	private IntegerUtils() {

	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy