java - Microsoft Access Color code conversion Logic to RGB or HEX or DEC value -
i have ms acess colour code . want convert color rgb or hex or dec. how convert using java .
you can use code convert ms access color code hex code :
import java.lang.stringbuilder; class test { private static final int sizeofintinhalfbytes = 8; private static final int numberofbitsinahalfbyte = 4; private static final int halfbyte = 0x0f; private static final char[] hexdigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; private static string finalhexcode; private static string dectohex(int dec) { stringbuilder hexbuilder = new stringbuilder(sizeofintinhalfbytes); hexbuilder.setlength(sizeofintinhalfbytes); (int = sizeofintinhalfbytes - 1; >= 0; --i) { int j = dec & halfbyte; hexbuilder.setcharat(i, hexdigits[j]); dec >>= numberofbitsinahalfbyte; } return hexbuilder.tostring(); } public static string finalhex(int dec) { string reversedhex = dectohex(dec); if(reversedhex.length() != 0) finalhexcode = "#"+reversedhex.substring(6, 8)+reversedhex.substring(4, 6)+reversedhex.substring(2, 4); return finalhexcode; } }
Comments
Post a Comment