All pastes #473013 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-05 23:54 UTC
rendered paste body
int stringLength = 4;




public String fillWithLeadingZeroes(int arg0) {
	//need to determine the length of the int
	int length = Integer.toString(arg0).length;
	
	return ...
	//insert as many zeroes as neccessary to have same length has stringLength IF length is not stringLength.
}



example:

arg0=34
returns 0034


arg0=23456
returns 23456


arg0=1234
returns 1234