Would someone be kind and improve this code

publicclass EvilSearchHeader{

privatestaticvoid calculateHeader(int totalResults,int resultsPerPage,int currentPage){

double totalPagesDbl = ((double)totalResults)/((double)resultsPerPage);

int totalPages = (int)Math.ceil(totalPagesDbl);

if(currentPage >= totalPages){

currentPage = totalPages;

}

resultsPerPage = (resultsPerPage <= totalResults)?resultsPerPage:totalResults;//how many on this page

int endingResult = resultsPerPage * currentPage;

int startingResult = -1;

if(endingResult > totalResults){

startingResult = endingResult - resultsPerPage;

endingResult = totalResults;

}else{

startingResult = endingResult - resultsPerPage;

}

if(startingResult > endingResult){

startingResult = endingResult -1;

}

System.out.println("displaying result "+startingResult+" - "+endingResult+//$NON-NLS-1$ //$NON-NLS-2$

" of "+totalResults+" | on page "+currentPage+" of "+totalPages);//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

}

publicstaticvoid main(String[] args){

int totalResults = 46;

int resultsPerPage = 5;

int currentPage = 7;

System.out.println("Calculate header for: \"total results\"="+totalResults+" \"current page\"="+currentPage);

calculateHeader(totalResults,resultsPerPage,currentPage);

}

}

[2888 byte] By [mkoryaka] at [2007-11-26 16:08:14]
# 1
What do you need the code to do? What do you mean by improve?If you need help, then you are going to have to meet us half way.
macrules2a at 2007-7-8 22:30:35 > top of Java-index,Java Essentials,Java Programming...
# 2
I suspect it's a parody of another post
georgemca at 2007-7-8 22:30:35 > top of Java-index,Java Essentials,Java Programming...
# 3
> I suspect it's a parody of another postok, didn't even look at it :)
macrules2a at 2007-7-8 22:30:35 > top of Java-index,Java Essentials,Java Programming...