Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: ensured code compiles

...

Code Block
bgColor#ccccff
BigInteger x = new BigInteger ("530500452766");
String s = x.toString();  // valid character data

try {
  byte [] byteArray = s.getBytes("UTF8");
  String ns = new String(byteArray, "UTF8");  // ns prints as "530500452766"

  BigInteger x1 = new BigInteger(ns); // construct the original BigInteger
} catch (UnsupportedEncodingException ex) {
  // handle error
}

Do not try to convert the String object to a byte array to obtain the original BigInteger. Character encoded data may yield a byte array which, when converted to a BigInteger, results in a completely different value.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="657d1d7c13ba3d16-8d5675cb-44ab4fc9-a1c6b7f4-ade4b1d764ac17e0ec2458da"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

class [String

http://java.sun.com/javase/6/docs/api/java/lang/String.html]

]]></ac:plain-text-body></ac:structured-macro>

...