Home > Java, Programming > My own DailyWTF

My own DailyWTF

March 7th, 2006

Today I was going through some Java code that was basically a straight port from VB 6 to make sure the functionality was there. During my review I came across the following:

In a private method:

int[] qtrMonths = {0,0,0,0};
for (int i=0;i<4;i++)
qtrMonths[i] = ((i+1)*3)-2;

Notice that the only variable that changes is the counter “i” :)

Wonder what the original VB guy was thinking on this one.

  • Share/Save/Bookmark
Author: Categories: Java, Programming Tags:
  1. March 7th, 2006 at 05:38 | #1

    Probably wanted to make sure ‘i’ is at 4, and wanted to debug it out.

    You know these VB 6 guys….

    </mock>

  2. Michael
    March 7th, 2006 at 14:59 | #2

    Are you saying this code runs and does something? The 1.5 compiler reports this as an error; you can’t cast from “int” to “int[]“.

  3. March 7th, 2006 at 15:09 | #3

    oops. Its qtrMonths[i]…sorry. I wasn’t able to copy/paste the code ;)

    Jason

  4. JerryJ
    March 7th, 2006 at 22:52 | #4

    Actually its brilliant! It leaves open the possibility of using the Aztec calendar!

  1. No trackbacks yet.