Java Integer to String intToString(final int value)

Here you can find the source of intToString(final int value)

Description

Convert an integer into an ASM HEX representation

License

Open Source License

Parameter

Parameter Description
value an integer value to be converted

Return

a hex string representation of the integer

Declaration

public static String intToString(final int value) 

Method Source Code

//package com.java2s;
/*/*from  w  w  w  .j a v a 2s.c o  m*/
 * Copyright 2012 Igor Maznitsa (http://www.igormaznitsa.com)
 * 
 * This file is part of the JVM to Z80 translator project (hereinafter referred to as J2Z80).
 *
 * J2Z80 is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * J2Z80 is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with J2Z80.  If not, see <http://www.gnu.org/licenses/>. 
 */

public class Main {
    /**
     * Convert an integer into an ASM HEX representation
     * @param value an integer value to be converted
     * @return a hex string representation of the integer
     */
    public static String intToString(final int value) {
        final StringBuilder result = new StringBuilder();

        result.append(value).append("(#").append(Integer.toHexString(value).toUpperCase()).append(')');

        return result.toString();
    }
}

Related

  1. intToStr(int value)
  2. intToStr(int value, int len)
  3. inttostr(String intStr)
  4. intToStr3(final int param)
  5. intToString(final int param)
  6. intToString(final Integer value)
  7. intToString(final long v, final int length)
  8. intToString(int i)
  9. intToString(int i)