Hello.java

This partially obfuscated Java program prints ”Ciao a tutti!” (Italian for ”Hello everyone!”) when executed. It's one of the very first pieces of code I wrote in Java.

/*
 *  Copyright (c) 2005, Federico Quagliata
 *  federico [at] REMOVETHIS quagliata [dot] org
 *
 *  All rights reserved.
 *
 *  Redistribution  and use  in  source and  binary forms,  with
 *  or  without modification,  are permitted  provided that  the
 *  following conditions are met:
 *
 *     * Redistributions  of source  code must retain  the above
 *  copyright notice, this list  of conditions and the following
 *  disclaimer.
 *
 *     * Redistributions in binary form must reproduce the above
 *  copyright notice, this list  of conditions and the following
 *  disclaimer  in  the  documentation  and/or  other  materials
 *  provided with the distribution.
 *
 *     * Neither the name of Federico Quagliata nor the names of
 *  its contributors may be used  to endorse or promote products
 *  derived from  this software  without specific  prior written
 *  permission.
 *
 * THIS  SOFTWARE  IS PROVIDED  BY  THE  COPYRIGHT  HOLDERS  AND
 * CONTRIBUTORS "AS  IS" AND ANY EXPRESS  OR IMPLIED WARRANTIES,
 * INCLUDING,  BUT NOT  LIMITED  TO, THE  IMPLIED WARRANTIES  OF
 * MERCHANTABILITY  AND FITNESS  FOR  A  PARTICULAR PURPOSE  ARE
 * DISCLAIMED.  IN  NO  EVENT   SHALL  THE  COPYRIGHT  OWNER  OR
 * CONTRIBUTORS BE LIABLE FOR  ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR  CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS  OF USE,  DATA,  OR PROFITS;  OR BUSINESS  INTERRUPTION)
 * HOWEVER CAUSED  AND ON  ANY THEORY  OF LIABILITY,  WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR  TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE)  ARISING  IN  ANY  WAY  OUT OF  THE  USE  OF  THIS
 * SOFTWARE, EVEN IF ADVISED OF  THE POSSIBILITY OF SUCH DAMAGE.
 *
 */
 
import java.io.*;
 
class Hello {
	int h=2;static PrintStream k=System.out;
 
	void j(String a){k.println(a);}String r(String a) {
		String r="",b;
		while(a.length()%8!=0){
			a="0"+a;} while(a.length()>0){b=a.substring(0,8);r+=(char)
			(Integer.parseInt(b,2));a=a.substring(8,a.length());
			} return r;}String g(int t){
			return r(Integer.toBinaryString(t));
		} public Hello() {
 
	    h = this.h;int y=(int)(p(2)*(1/(float)p(2))) +
		p(1)*(1+p(1)+p(2)+p(4) +
		p(5))+(int)(p(9) * (1/(float)p(1)))+p(13)+p(14) +
		(int)(p(17)*(1/(float)p(1)))+p(19)+p(21)+p(22) + 
		p(24)+p(25)+p(30);int z
	      = p(0)+p(5)+p(6);int p=p(2)+p(4)+p(5)+p(6) +
	        p(8)+p(10)+p(12)+p(13)+p(14)+p(18)+p(20) +
		p(21)+p(22);int n=p(0)+p(5)+p(8)+p(11)+p(13) +
		p(14)+p(18)+p(20) + (p(21) + p(22));j(g(y)+g(p(5)) + 
		g(z)+g(p(5))+g(p)+g(n));}public static
 
	void main (String[] args){new Hello();}int p(int d) {
		int g=1;int p=1;int h=this.h;		
		while(p<=d){g=g*h;p++;}
			return g;
	}
}

Back to top