If you're careful about how you define the surface, then you will get the correct direction out of Maxwell's equations. In vector calculus (and generally in math and physics), a surface has an orientation, which also specifies the orientation of the loop that forms its boundary. So you can't just pick a direction to go around the loop at random. The direction in which you go around the loop is related to the orientation of the normal vector to the surface.

Of course, you don't actually need to do a surface integral to figure this out. The electric and magnetic fields in an EM wave (at any given position and moment in time) are related by the equation

$$\mathbf{B} = \frac{1}{c}\hat{\mathbf{k}}\times\mathbf{E}$$

where $\hat{\mathbf{k}}$ is a unit vector that points in the direction of propagation of the wave. If you don't know which direction the wave is moving, you can't tell which way the magnetic field points.

How to determine directions of vectors of an electromagnetic wave
I have made a program to count the number of vowels and consonants in an inputted string:

        Scanner in = new Scanner(System.in);


System.out.print("Enter a string ");
    String phrase = in.nextLine();

int i, length, vowels = 0;
int consonants = 0;
boolean y = false;
String j;
length = phrase.length();
for (i = 0; i &lt; length; i++)
{



        j = "" + phrase.charAt(i);


     boolean isAVowel = "aeiou".contains(j.toLowerCase());
     boolean y = "y".contains(j.toLowerCase());


     if(isAVowel){
         vowels++;
     }else if(isAVowel &amp;&amp; y){
     vowels++;
    consonants++;
//}else if(y &amp;&amp; !(isAVowel)){
//   vowels++;
      }else{
      consonants++;
      }


System.out.println("The number of vowels in \"" +phrase+"\" is "+ vowels+".\n\nThe number of consonants is "+consonants+".\n\n");


When "y" is by itself it says its a consonant, it should be a vowel. Where do I state this?
