All pastes #352485 Raw Edit

Stuff

public java v1 · immutable
·published 2007-02-12 21:11 UTC
rendered paste body
int userSpecifiedLineWidth = 5 // tämä pitä kysyä käyttäjältä siisBufferedReader file = BufferedReader(new InputStreamReader(lukija)); // oletan että lukija osottaa oikeaan filuunString printFirst = null;while ((String line = file.getLine()) != null) {	if (printFirst != null) {		int newChars = userSpecifiedLineWidth - printFirst.length()		System.out.print(printFirst);		System.out.println(line.subString(0, newChars));		line = line.subString(newChars);		printFirst = null;	}	int iterations = line.length() / userSpecifiedLineWidth;	int endChars = line.length() % userSpecifiedLineWidth;	for (int i = 0; i < iterations; i++)		System.out.println(line.subString(i * userSpecifiedLineWidth,						  (i+1) * userSpecifiedLineWidth));	if (endChars != 0)		printFirst = line.subString(iterations * userSpecifiedLineWidth, endChars);}