Created
January 16, 2013 05:49
-
-
Save isaacsanders/4544971 to your computer and use it in GitHub Desktop.
Any thoughts on making this even more awful?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int search(Integer[] arriArrayToBeSearched, Integer iItemToBeFoundInArray){ | |
int iIndexOfItemToBeFoundInArrayInArrayToBeSearched = -1; | |
int iLengthOfArrayToBeSearched = 0; | |
int iTemporaryVariable = arriArrayToBeSearched.length; | |
while (iTemporaryVariable > 0) { | |
iLengthOfArrayToBeSearched += 1; | |
iTemporaryVariable -= 1; | |
} | |
for (int indexInArrayToBeSearched = 0; indexInArrayToBeSearched < iLengthOfArrayToBeSearched; indexInArrayToBeSearched += 1) { | |
Integer iMemberOfArrayToBeSearchedAtCurrentIndex = arriArrayToBeSearched[indexInArrayToBeSearched]; | |
boolean bMemberOfArrayToBeSearchedAtCurrentIndexIsEqualToTheItemToBeFoundInArray = iMemberOfArrayToBeSearchedAtCurrentIndex.equals(iItemToBeFoundInArray); | |
if (bMemberOfArrayToBeSearchedAtCurrentIndexIsEqualToTheItemToBeFoundInArray) { | |
iIndexOfItemToBeFoundInArrayInArrayToBeSearched = indexInArrayToBeSearched; | |
} | |
} | |
return iIndexOfItemToBeFoundInArrayInArrayToBeSearched; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or you could put
At the beginning.