Check the counter.
Complete all characters increasing the counter for each reading. When you reach the counter limit corresponding to the beginning of the skipped characters, skip the characters you need to skip.
int counter = 0; while (counter < START_SKIP) { int x = input.read();
If necessary, use BufferedReader to improve performance, as Tunaki said (or BufferedInputStream , depending on the type of file you are reading, in a binary or text file).
source share