Here you can find the source of unsignedMediumToBytes(final Long unsignedInt)
Parameter | Description |
---|---|
unsignedInt | representing the unsigned integer |
public static byte[] unsignedMediumToBytes(final Long unsignedInt)
//package com.java2s; /**//from w w w . j a v a 2s . c o m * Copyright (c) 2013 Cisco Systems, Inc. and others. 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 */ public class Main { /** * Converts unsigned integer to a 3 byte array of unsigned bytes * * @param unsignedInt representing the unsigned integer * @return bytes an array of 3 unsigned bytes */ public static byte[] unsignedMediumToBytes(final Long unsignedInt) { byte[] bytes = new byte[3]; bytes[2] = (byte) (unsignedInt & 0xFF); bytes[1] = (byte) ((unsignedInt >> 8) & 0xFF); bytes[0] = (byte) ((unsignedInt >> 16) & 0xFF); return bytes; } }