Jump to Real's How-to Main page

Number of the beast!

public class Gates {
  static String beast = "BillGates";

  public static void main(String args[]) {
   char [] temp = beast.toUpperCase().toCharArray();
   int j = temp.length;
   int i = 0;
   int k = 0;
   while (i < j) {
     k += temp[i++];
     System.out.println(temp[i-1]);
   }
   // Since it's really "Bill Gates III"
   System.out.println(k + 1 + 1 + 1);
   // output : 666 :-)
   }
}

If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]