Show results of a runners' competition with details about each runner This is about to show the results of a runners' competition.  It shows us the runner's number, the sex ( 1 = man, 0 = woman ), age and time.  After showing the results of these runners, it shows the winner of each sex.

package *;
public class ArraysSix {
    public static void main(String[] args) {
      //int pm = position man, pw = position woman
      int pm = 0;
      int pw = 0;

      String[] a = {"Runner", " Sex", " Age", "    Min"};
      String[][] b = {                
            {"  3457", "   1", "  41", "     39"}, 
            {"   344", "   1", "  30", "     38"},
            {"  3333", "   0", "  28", "     45"},
            {"  3450", "   0", "  45", "     50"},
            {"   101", "   1", "  21", "     52"},
            {"   455", "   1", "  37", "     41"},
            {"   100", "   0", "  40", "     37"},             
      };
      //array int
      int[][] c = {
            { 3457, 1 , 41 , 39 }, 
            { 344 , 1 , 30 , 38 },
            { 3333, 0 , 28 , 45 },
            { 3450, 0 , 45 , 50 },
            { 101 , 1 , 21 , 52 },
            { 455 , 1 , 37 , 41 },
            { 100 , 0 , 40 , 37 },             
     };
     //for print title
     for (int i = 0; i &lt; a.length; ++i) {
        System.out.print("|"+a[i]+"|");         
     }
     System.out.println("\n-----------------------------");
     //for print numb
     for (int i = 0; i &lt; b.length; ++i) {
        for(int j = 0; j &lt; b[i].length; ++j) {
            System.out.print("|"+b[i][j]+"|");
        }
        System.out.println("\n-----------------------------");
     }
     //for to find the minimun time of man
     for ( int i = 0 ; i &lt; 7 ; i++) {
        if ( c[i][1] == 1 ) {
            if ( c[i][3] &lt; c[pm][3] ) {
                pm = i ;
            }
        //else to find the minimum of woman 
        } else {
            if ( c[i][1] == 0 ) {
                if ( c[i][3] &lt; c[pw][3] ) {
                    pw = i ;
                }
            }
        }//end else
    }//end for      

    //for to print the winners
    for (int i = 0 ; i &lt; 1 ; i++ ) {
        System.out.print("Runner num "+c[pm][0]
                +" with an age of "+c[pm][2]
                +" and time of "+c[pm][3]
                +" min is the male winner.");
        System.out.println("");

        System.out.print("Runner num "+c[pw][0]
                +" with an age of "+c[pw][2]
                +" and time of "+c[pw][3]
                +" min is the female winner.");
    }//end for 
 }//end method
}//end class 


So I think there's is a better way to make this piece of program, but I don't have the knowledge yet.
for (int i = 0; i &lt; a.length; ++i) {
        System.out.print("|"+a[i]+"|");         
     }



This could be just 

     for (String heading : a) {
         System.out.print("|" + heading + "|");
     }


You don't need an i variable.  


        for(int j = 0; j &lt; b[i].length; ++j) {
            System.out.print("|"+b[i][j]+"|");
        }
        System.out.println("\n-----------------------------");



This could be 

        System.out.println(
            String.format("|%6d||%4d||%4d||%7d|\n-----------------------------",
            c[0], c[1], c[2], c[3]));


This allows you to get rid of b entirely.  

You might point out that this hard codes c[0], etc.  But that's not nearly as big a deal as it might first seem.  The formats are specific for each one, so you have to write out those variables anyway.  The real solution would probably be a Runner class where you could say things like runner.getNumber() instead of c[0].  Because right now it's not clear why 0 means Runner.  


      //int pm = position man, pw = position woman
      int pm = 0;
      int pw = 0;



If we replace that with 

      final int SEX_COUNT = 2;
      int[] firstBySex = int[SEX_COUNT];


Then we can change 


     //for to find the minimun time of man
     for ( int i = 0 ; i &lt; 7 ; i++) {
        if ( c[i][1] == 1 ) {
            if ( c[i][3] &lt; c[pm][3] ) {
                pm = i ;
            }
        //else to find the minimum of woman 
        } else {
            if ( c[i][1] == 0 ) {
                if ( c[i][3] &lt; c[pw][3] ) {
                    pw = i ;
                }
            }
        }//end else
    }//end for  



with 

    for (int runner = 0; runner &lt; c.length; runner++) {
        int sex = c[runner][1];

        // [3] is the runner's time
        if (c[firstBySex[sex]][3] &gt; c[runner][3]) {
            firstBySex[sex] = runner;
        }
    }


We no longer hard code the number of rows in c.  Now, if we change the number of rows in c, the code automatically handles it.  

We don't have to handle males and females separately.  We use the same code for both.  

The intermediate variable sex saves us from having to write a comment explaining what column 1 is.  


    //for to print the winners
    for (int i = 0 ; i &lt; 1 ; i++ ) {
        System.out.print("Runner num "+c[pm][0]
                +" with an age of "+c[pm][2]
                +" and time of "+c[pm][3]
                +" min is the male winner.");
        System.out.println("");

        System.out.print("Runner num "+c[pw][0]
                +" with an age of "+c[pw][2]
                +" and time of "+c[pw][3]
                +" min is the female winner.");
    }//end for 



You could write this as 

    for (int sex = 1; sex &gt;= 0; sex--) {
        System.out.println(formatRunnerData(c[firstBySex][sex]]));
    }


with an array 

public final String[] SEXES = { "female", "male" };


and a helper method 

public static String formatRunnerData(int[] runnerData) {
     StringBuilder builder = new StringBuilder();

     builder.append("Runner num ").append(runnerData[0])
         .append(" with an age of ").append(runnerData[2])
         .append(" and time of ").append(runnerData[3])
         .append(" min is the ").append(SEXES[runnerData[1]).append(" winner.");

     return builder.toString();
}


Now if you make a change to this display, you can make it in one place rather than two.  

Originally, you didn't need a for loop.  You only ran the code once.  This makes use of a loop.  

This adds an extra end of line at the end, which I find better anyway.  So if you add more text, you don't have to put an end of line before it to print on a new line.  

Other than that, this should produce the same display.