Java Integer to intToWeb(int color)

Here you can find the source of intToWeb(int color)

Description

int To Web

License

Open Source License

Declaration

public static String intToWeb(int color) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String intToWeb(int color) {
        int b = (color) & 0xFF;
        int g = (color >> 8) & 0xFF;
        int r = (color >> 16) & 0xFF;
        return hex2d(Integer.toString(r, 16)) + hex2d(Integer.toString(g, 16)) + hex2d(Integer.toString(b, 16));
    }//  w ww  .  j a va 2s .c  o  m

    public static String hex2d(String tmp) {
        if (tmp.length() == 1)
            return "0" + tmp;
        else
            return tmp;
    }
}

Related

  1. intToUnsigned(int signed)
  2. intToUnsignedByte(int i)
  3. intToUnsignedInt(int data)
  4. intToUnsignedLong(int data)
  5. intToUnsignedShort(int value)
  6. intToZigZag(final int n)