Conversion of Decimal to Hexadecimal
<p>Let me describe the scenario first.</p>

<p>What I'm trying to do is convert a string to hex.</p>

<p>For example let's say a binary string comprising of 1s &amp; 0s viz. 110011,
pairing them as a group of 4 digits(appending two 0s for 8 digits here), converting each pair into hex separately and then joining the hex string result to obtain the output.</p>

<p>For octal, same as was for binary but here input octal string is split into groups of 3 digits</p>

<p>For ASCII, each digit's byte equivalent is converted to hex and stored.</p>

<p>Now the problem is what should I do for decimal string input?</p>

<p>-Should I consider using the same method as that for ASCII?
-Or is there another way?</p>

<p>EDIT :-</p>

<p>I'm not just converting numbers, but converting an array of numbers.</p>

<p>Binary string - groups of 4 digits &amp; then convert them to hex<br>
Octal string - groups of 3 digits &amp; then convert them to hex<br>
ASCII string - byte equivalent for each character &amp; then convert that to hex</p>

<p>So length isn't the issue. The issue is how to convert the decimal string(what sort of pairing/grouping should I use)</p>

<p><b>NOTE :</b> I already know about converting octal, binary &amp; decimal numbers to hex. This part is more about how to "divide the decimal string into groups" so as to convert each decimal group into hex separately and then joining the resultant hex.</p>