jaakko_m has asked for the wisdom of the Perl Monks concerning the following question:
private byte[] getBytes(String hexText) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); StringTokenizer stToken = new StringTokenizer(hexText, "-", false); while (stToken.hasMoreTokens()) { String token = stToken.nextToken(); int i = Integer.parseInt(token, 16); if (token.length() > 2) { byte b = (byte) (i >>> 8); baos.write(b); } baos.write((byte) i); } return baos.toByteArray(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Port Java code to Perl help
by toolic (Bishop) on Apr 14, 2012 at 01:18 UTC | |
|
Re: Port Java code to Perl help
by davido (Cardinal) on Apr 14, 2012 at 00:59 UTC | |
|
Re: Port Java code to Perl help
by mbethke (Hermit) on Apr 14, 2012 at 07:43 UTC | |
by Eliya (Vicar) on Apr 14, 2012 at 09:34 UTC | |
|
Re: Port Java code to Perl help
by BrowserUk (Patriarch) on Apr 14, 2012 at 08:31 UTC | |
by jaakko_m (Initiate) on Apr 23, 2012 at 03:55 UTC | |
|
Re: Port Java code to Perl help
by halfcountplus (Hermit) on Apr 14, 2012 at 13:56 UTC |