04.01.2013 Views

DoD Implementation Guide for CAC PIV End-Point - Common ...

DoD Implementation Guide for CAC PIV End-Point - Common ...

DoD Implementation Guide for CAC PIV End-Point - Common ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>DoD</strong> <strong>Implementation</strong> <strong>Guide</strong> <strong>for</strong> <strong>CAC</strong> <strong>PIV</strong> <strong>End</strong>-<strong>Point</strong><br />

}<br />

throws UnsupportedEncodingException{<br />

String str;<br />

char[] chr = new char[(length * 2)];<br />

<strong>for</strong>(int i=0; i < length; i++){<br />

int h = (buf[i] & 0xF0) >> 4;<br />

int l = buf[i] & 0x0F;<br />

char c=0;<br />

if(h < 0x0A){<br />

chr[i*2] = (char)(h + '0');<br />

}<br />

else{<br />

chr[i*2] = (char)(h - 10 + 'A');<br />

}<br />

if(l < 0x0A){<br />

chr[(i*2)+1] = (char)(l + '0');<br />

}<br />

else{<br />

chr[(i*2)+1] = (char)(l - 10 + 'A');<br />

}<br />

}<br />

return new String(chr);<br />

} // END OF SAMPLE PROGRAM ******************************************<br />

Output from program execution:<br />

37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!