r/ProgrammerHumor • • Oct 15 '18

A Python programmer attempting Java

Post image
517 Upvotes

78 comments sorted by

View all comments

Show parent comments

61

u/Proxy_PlayerHD Oct 15 '18

or just write it all on a single line

public class Permuter{private static void permute(int n, char[] a){if(n == 0){System.out.println(String.ValueOf(a));}else{for(int i = 0; i <= n; i++){permute(n-1, a); swap(a, n % 2 == 0 ? i : 0, n);}}}private static voice swap(char[] a, int i, int j){char saved = a[i]; a[i] = a[j]; a[j] = saved;}}

37

u/therealchadius Oct 15 '18

Right there, officer. There's the criminal!

9

u/Proxy_PlayerHD Oct 15 '18

i'm just efficent.

5

u/[deleted] Oct 15 '18

He's being efficient! GET 'IM!