Here you can find the source of toPushbackReader(BigInteger x)
public static PushbackReader toPushbackReader(BigInteger x) throws IOException
//package com.java2s; //License from project: LGPL import java.math.BigInteger; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PushbackReader; import java.io.IOException; public class Main { public static PushbackReader toPushbackReader(BigInteger x) throws IOException { byte[] bytes = x.abs().toByteArray(); final int startB = (x.signum() < 0 ? '-' : -1); // Start the stream with minus sign in case of negative number InputStream in = new ByteArrayInputStream(bytes) { public int read() { int c; if (this.b == -1) { this.b = super.read(); if (this.b == -1) { c = -1;/*from w w w. j a va 2 s . co m*/ } else { c = Character.forDigit(this.b >> 4, 16); this.b = Character.forDigit(this.b & 0x0F, 16); } } else { c = this.b; this.b = -1; } return c; } public int read(byte[] b, int off, int len) { int i = 0; for (; i < len; i++) { int c = read(); if (c == -1) { i = (i == 0 ? -1 : i); // In case of EOF; there was nothing to read in the stream break; } b[i + off] = (byte) c; } return i; } private int b = startB; }; return new PushbackReader(new InputStreamReader(in, "ISO-8859-1")); } }