...
Code Block | ||
---|---|---|
| ||
BigInteger x = new BigInteger ("530500452766"); byte [] byteArray = x.toByteArray(); // convert to byte array String s = new String(byteArray); // s prints as "{âJ?ž" - // the fourth character is invalid // convert s back to a BigInteger byteArray = s.getBytes(); // convert to bytes x = new BigInteger(byteArray); // now x = 530500435870 |
...
Code Block | ||
---|---|---|
| ||
BigInteger x = new BigInteger ("530500452766"); String s = x.toString(); // valid character data byte [] byteArray = s.getBytes("UTF8"); String ns = new String(byteArray, "UTF8"); // ns prints as "530500452766" BigInteger x1 = new BigInteger(ns); // construct the original BigInteger |
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
References
Wiki Markup |
---|
\[[API 06|AA. Java References#API 06]\] class [String|http://java.sun.com/javase/6/docs/api/java/lang/String.html] |
...
FIO36-J. Do not create multiple buffered wrappers on an InputStream      09. Input Output (FIO)      09. Input Output (FIO)