CyberArmy University | Open Source Institute | CyberArmy Intelligence & Security | CyberArmy Services & Projects

RE: 2 questions


[Replies] [Reply] [View by Thread] [Help]
[Back To SNEAK Development Forum]

Posted by Tr flamebalrog On 2005-03-24 22:41:05
In Reply to 2 questions Posted by Maj anvar On 2005-03-18 17:19:21

Tr
Tr flamebalrog


>Also, if not String.format() then how else can I get this output (coz this is about the best way I could come up with).

mmhhh...proposed dirty way follows :
private String bytesToHexaString(byte[] byteArray) {
    StringBuffer str=new StringBuffer(byteArray.length*2);
    for (long i=0;i<byteArray.length;i++) {
        int currentByte=byteArray[i];
        if (currentByte<0)
            currentByte+=256;
        if (currentByte<16)
            str.append('0');
        str.append(Integer.toHexString(currentByte));
    }
    return str.toString();
}
Does it help ?



- Is it a feature or a bug ? -


Replies:


Guest:
Subject:
Message:
Signature:
Optional Image Link:
http://

CyberArmy::Forum v0.6
Generated In 0.02310 seconds


About Us | Privacy Policy | Mission Statement | Help