Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Java

(bytecode-version with loader)

Date:05/23/06
Author:Tilo Dickopp
URL:http://www.tiloswelt.de/
Comments:9
Info:n/a
Score: (3.41 in 291 votes)
public class BeerSongLoader extends ClassLoader {
  private static final String BEER_SONG =
	  
    " #§$%MBVC?*9@QW68Q986@9                                                                   " +
    " @6######%§##%@#9##§§##§9                                                                 " +
    "   #C##§@#9#   ##$##§9#?#                                                                 " +
    "   #§Q#?##§W    #?##§6#9#                                                                 " +
    "   #§8##$##9    ###$##$§#         ?##$$#?##           $%#?##$M#?         ##$B#?#  #$V#?#  " +
    "   #$C#?##$?    #9###$##       $*#C##$9#9##$@       ##$Q#9##$W##$6   #C##$8#§### V%QV*V6V " +
    "   *CM%6#§###%$?$*BV#§#       ##MM%V8   VMVB#§#   ##?CMV8B  %CMC$V*  V6VC#§##§M$?$*MQV9V§ " +
    "   CVV§$8VQV§V6VC$8B%CMC$    V*V6VC%    @#Q##§B  ##§V#§##    §CV9V§C   VV§$8VQV§V6VC$8B%C " +
    "   MC$V*V6VCM$CBV*VQVMVBC$  #§##%WC@%#$QV%V?V8V* V%VB$Q%#$%V6V8$#VWV   8C$VB$#V$  V8CMCM  " +
    "   VQVBC%CQ%     §$%%§$#V$V 8CMCMVQVBCQ%§%QC@%#  CW$#V$V8CMCMVQVBC%C   W$#V8VV$#          " +
    "   V$VBVBC$#     §###§V6#§# ##§M6#C##            %##Q##%§              ##%$#Q##           " +
    "   %%##%M#§#     ##6$#V8V6$  #CMV?VB$#           CCV§VQVQ$             Q$##§###$          " +
    "  $6#9#§##$WC   @%#$QV%V?V    8V*V%VB$Q%#$%MCV8   $#CMV8$#CMV?VB$#C%   CMV8C$VB$          " +
    "  #V§V6VM$#V$CBC*$#C%V8VWV      B$#VWV8C$VB#§##$    VCQ%#%QBMV§V@VB$  #V8V6VB$#VMV8C      " +
    " CV6$#V§V6VM$#C#V§C%C%$#          V*CM$#V§C$V         8CBV6VMCW$Q$    ##§###$C@%##§#      " +
    "                                                                                          " +
    " ##$C@%§#§###8$#V8V6$#C                                                                   " +
    " MV?VB$#CCV§VQVQ$6#9#9#Q#                                                                 " +
    "   #§?##§*#§   ##§#V9V§CV                                                                 " +
    "   V§$8VQV§V    6VC$8M8V$                                                                 " +
    "   V9VBV%CM#    C##%B#Q##         %V##%C#C#           #%?#Q##%*#         #%9#§##  #?M$VB  " +
    "   VBC$B%V8V    6VC#§##§       #V9V§CVV§$8VQV       §V6VC$8B%CMC$V   *V6VC#§###C C$VBC#VQ " +
    "   V§V%VB#§##MM$?MQV9V§       CVV§$8V   QV§V6VC   $8M%V?V§  C$B%VBC  §CBVBV6V%VB%@MQV9V§C " +
    "   VV§$8VQV§V6VC$8M%V?V§C    $B%VBC§    CBVBV6V  %VB%@$*M    QV9V§CV   V§$8VQV§V6VC$8B%CM " +
    "   C$V*V6VC%@#§###VV§C#C#V  BV6VM#§##$W$?MQV9V§C VV§$8VQV§V6VC$8B%CM   C$V*V6VC%  @$*MQV  " +
    "   9V§CVV§$8     VQV§V6VC$8 B%CMC$V*V6VCM$CBV*V  QVMVBC$%@#§##§§V9V§   CVV§$8VQV          " +
    "   §V6VC$8M*     V6CMVBVCVB C$#§###CC            VV§VQCBV              BM8VV#§#           " +
    "   #§V$?M*$*     MQV9V§CVV§  $8VQV§V6V           C$8M*V6CM             VBVCVBC$%          " +
    "  @#§##§CV9V§   CVV§$8CMVB    C?CM$8MWVBC%C%V§V   CVBMVV8C$VWV§CM#§#   ##VVVV8C$          " +
    "  VWV§CM#§##%*$?MQV9V§CVV§      $8VQV§V6VC$8B%CM    C$V*V6VC%@B@MQV9  V§CVV§$8VQV§V6      " +
    " VC$8M8V$V9VBV%CM%@$*MQV          9V§CVV§$8VQ         V§V6VC$8B%CM    C$V*V6VC%@##$§      " +
    "                                                                                          " +
    " ##§M##§§###########$##                                                                   " +
    " #§##§B##§V###§##§C######                                                                 " +
    "   §§###§###   §#######B$                                                                 " +
    "   9@C###§@§    #########                                                                 " +
    "   ##§##§?##    §*###§##§         C######?V           ###C###M##         ####C9@  @###$B  " +
    "   *@C###%MQ    §#V%%W§Q       *@##V*§$#MM6$@       @@###$B*@C###%   $W§$#B§$#V@ V###C@V# " +
    "   ##?§$#*@V###?$W@V###       ?§$#9@V   ###?§$#   @@V###?§  $#Q@V##  #?$W§$#W§$#6@V###C@V " +
    "   ###?§$#8@V###?@V##§##B    @W##§§B    *#%§Q@?  ##§$B%B*    #M§Q§#V   %V#§#VMC#@?##§$B%@ " +
    "   ?##§%@V###?BC?M#$889C88  **$@@V##§#@######### ####C§$*M§QCC@@#V*?   M%V*Q9?C%  B§Q%CM  " +
    "   @C9V@Q8C$     *@6#M9B§%6 %@Q*§B6#C?CQ?*9WQ%9  9QVC#89B§#*6CQ%#*B§   V?9$9QMV§          " +
    "   M@Q@V6V88     8V9§@W96M$ §??V8M@C%            %**MQ@§*              $§VC%$@*           " +
    "   C§8?M98QC     #M$9W%$6B9  VV$$§WCMQ           $%#W8§#QB             ?W8C?$W9@          " +
    "  96C9@V?%$*6   89BVWV@W8@    VM$M#CC8V$@M$6M*%   V#$MC6W#§%%%*8#CM@   M*B@%9$W?          " +
    "  $9$99M$?*8B$VM8CC§CW6W@*      %W%CC?@#§?B8@W%9    ?*%$9B%8Q*§BQ$Q9  6@V9#?V98C$M$M      " +
    " M@%??C88M$86M$QV§WC?B?V          Q%§B8§#%?MQ         B6§BM?B9@#$%    WQMW?BBBB?#§§6      ";

  @Override public Class<?> loadClass(String name) throws ClassNotFoundException {
    String alphabet = "";
    byte[] code = new byte[946];
    int i = 0, j = 0;
    boolean firstNibble = false;
    while (i < 946) {
      while (BEER_SONG.charAt(j) == ' ') j++;
      if (alphabet.length() < 16)
        alphabet += BEER_SONG.charAt(j++);
      else if (firstNibble = !firstNibble)
        code[i] = (byte)(alphabet.indexOf(BEER_SONG.charAt(j++)) * 16);
      else
        code[i++] += alphabet.indexOf(BEER_SONG.charAt(j++));
    }
    return name.equals("BeerSong") ? defineClass(name, code, 0, 946) 
                                   : findSystemClass(name);
  }

  public static void main(String[] args) throws Throwable {
    Class<?> beerSong = new BeerSongLoader().loadClass("BeerSong");
    System.out.println(beerSong.newInstance());
  }
}

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
object-oriented versionAnonymous04/20/0514
Java 5.0 object-oriented versionKvols11/19/053
exception orientedJarek Ratajski09/08/051
Singing with Java Speech APIKevin Seifert05/04/061
standard versionSean Russell04/20/0510

Comments

>>  SM said on 06/07/06 21:54:10

SM Much cooler than these cheapy eyedrop-perl thing. I like it!

>>  nameless said on 08/31/06 09:22:27

nameless Sorry for my stupidity, but how to run it?

>>  Luis Carlos F. Dias said on 10/26/06 23:27:35

Luis Carlos F. Dias to nameless:

Save the source in a file named BeerSongLoader.java and run:

javac BeerSongLoader.java

java BeerSongLoader

>>  ssilagi said on 05/09/07 12:51:21

ssilagi Very cool!!! nice job...

>>  skywriter14 said on 06/19/07 04:15:23

skywriter14 @SM:
Keep hating. Someday there will be one programming language in this world. Only for guys like you. We shall all die to make you happy.

>>  Alex Mirchev said on 07/12/07 18:32:38

Alex Mirchev That language is definatly java.. btw, why is your code so weird... it doesnt look like a correct syntax...

>>  Robstown Holanda said on 10/04/07 21:56:26

Robstown Holanda very good, congratulations

>>  Homer said on 12/09/07 17:36:41

Homer Fantastic!!!

You're the greatest freak ever seen ;-)

>>  Mike Alcock said on 03/07/08 16:41:48

Mike Alcock Bloody hell, that's one brilliant program. And, somehow, it works. Well done Tilo!

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: