Java Hex Calculate toHexValue(int number)

Here you can find the source of toHexValue(int number)

Description

to Hex Value

License

Mozilla Public License

Declaration

public static String toHexValue(int number) 

Method Source Code

//package com.java2s;
/*  //from  w ww . ja v  a  2  s . com
 * SMART FP7 - Search engine for MultimediA enviRonment generated contenT
 * Webpage: http://smartfp7.eu
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 
 * 
 * The Original Code is Copyright (c) 2012-2013 the University of Glasgow
 * All Rights Reserved
 * 
 * Contributor(s):
 *  Dyaa Albakour <dyaa.albakour@glasgow.ac.uk>
 */

public class Main {
    public static String toHexValue(int number) {
        StringBuilder builder = new StringBuilder(Integer.toHexString(number & 0xff));
        while (builder.length() < 2) {
            builder.append("0");
        }
        return builder.toString().toUpperCase();
    }
}

Related

  1. toHexStringLE(byte n)
  2. toHexStringUpperCase(byte[] b)
  3. toHexTable(byte[] byteSrc, int lengthOfLine)
  4. toHexText(byte[] bytes, int length)
  5. toHexUtil(int n)
  6. toHexWithMarker(byte b)