OK, I've got it to work and put in an acesHiLow variable (-1 for low, 0 for either or 1 for high) and this should work as a test to see if all the cards in a given hand are in a run.
Where aces are high or low, the thing only works for 5-card hands, but hopefully I'll work out a way to fix it so it will work for any number of cards.
Code:
public boolean isStrait(int acesHiLow){
boolean isstrait = false;
int maskval = 1;
int val = 0;
int lowest = Integer.MAX_VALUE;
for (int i = 0; i< myHand.size();i++) {
if (acesHiLow == -1 || myHand.card(i).value != 1){
val = val | (1 << myHand.card(i).value);
maskval = maskval << 1;
lowest = Math.min(myHand.card(i).value, lowest);}
if (acesHiLow == 0 && myHand.card(i).value == 1){
val = val | (1 << myHand.card(i).value);
val = val | (1 << 14);
maskval = maskval << 1;
maskval = maskval << 1;
lowest = Math.min(myHand.card(i).value, lowest);}
if (acesHiLow == 1 && myHand.card(i).value == 1){
val = val | (1 << 14);
maskval = maskval << 1;
lowest = Math.min(14, lowest);}
}
val = val >> lowest;
if (val + 1 == maskval){return true;}
if ((acesHiLow == 0 && val == 8223) || (acesHiLow == 0 && val == 15873)){return true;}
// System.out.println(val + " " + maskval );
return false;
}
Thanks again.