5! = 1·2·3·4·5
I lied. Here are some of the weirdnesses of this code:

1. Returning a string? Already something seems a bit amiss.
2. Why name a function like this "access"?
3. Passing "5!" as a a variable name, even though struck out, is a telling mixup of variable name and content.
4. More string oddness. These two lines seem to indicate he's just trying to parse the first character of the String passed in to an int, ignoring the rest.
5. To the right of "c -", there's NOTHING about Integers...I'm willing to give him a pass in terms of specific function name (Integer.valueOf(String) would have "worked" as a replacement for String.getValue(String)) but he's not even in the ballpark.
6. The use of "if"s here, 3 conditional cases, is just an astounding example of misthink. Logically, only Strings starting with 0-3 will produce any output, and even then if it's a "one digit string" of the values 1-3 could this logic conceivably "work".
7. Finally, the use of "System.err" rather than "System.out" is just... well, wrong. Or maybe so right, a subtle bit of self-commenting on the error-ridden code...

An even half-way decent programmer when given this problem would likely think for a moment and then say "do you care if it's solved recursively or iteratively"? (With the latter being the better bet, performance wise, but that's a small issue). Also, this is kind of an "academic" problem, and the guy seemed to have a strong academic background...besides talking a *great* game about all the latest technologies, and getting some complex stuff about J2EE right. It's just really odd.
--Kirk Wed Nov 9 08:05:17 2005
Yeah that is some high levels of "not getting it". Plus, the way it is written I thought he was writing C++, never a compliment to a Java programmer.

Unrelatedly, I changed my work IM name to "whiskeysawers" after you reminded me.
--Mr. Ibis Wed Nov 9 10:01:50 2005
would you have chuckled if I wrote "sub Factorial(x) {if(x==1){return(x)}else{return(x*Factorial(x-1))}}" ?

What if I said afterwards that I knew you asked for java, but I did't think it was appropriate for me to serve coffee?

I've often tried to answer such questions in a way that shows the interviewer I understood the question, I just chose to have fun. 

That way, if the company can't stand somebody who totally ignores conventional hierarchical corporate culture I find out right away, without wasting anyone's time.
--Charlie Fri Jul 20 19:24:49 2007

Comments Disabled... (Thanks Dirty Rotten Spammers)
Feel free to write kirkjerk at gmail dot com!