import java.io.*; import java.math.*; import java.util.*; public class Main { public static void main(String[] args) { long longValue = Long.MAX_VALUE; BigInteger valueFromLong = BigInteger.valueOf(longValue); System.out.println(valueFromLong); System.out.println(new BigInteger("10", 2)); byte[] bytes = new byte[] { (byte) 0x80 }; BigInteger valueFromBytes = new BigInteger(bytes); System.out.println(valueFromBytes); valueFromBytes = new BigInteger(1, bytes); System.out.println(valueFromBytes); System.out.println(new BigInteger(32, new Random())); // BigInteger(int numBits, Random rnd) BigInteger x = new BigInteger("530500452766"); System.out.println(x); byte[] byteArray = x.toByteArray(); String s = new String(byteArray); byteArray = s.getBytes(); x = new BigInteger(byteArray); System.out.println(x); s = x.toString(); // έγκυρη μετατροπή try { byteArray = s.getBytes("UTF8"); String ns = new String(byteArray, "UTF8"); System.out.println("ns="+ns); BigInteger x1 = new BigInteger(ns); System.out.println("x1="+x1); } catch (UnsupportedEncodingException ex) { } } }