MATRICES.
 Bidimensionales (matrices)
Las matrices se definen, como un arreglo bidimensional, en donde tenemos un número de reglones N y un número de columnas M. 
·         MATRIZ     4 x  4
                       3    5    7    2
                       4    6    1    4
                       2    3    5    6
                       6    5    4    7
Pasos:
·         INICIALIZAR.
·         INGRESAR DATOS.
·         MOSTRAR DATOS.
1.- INICIALIZAR UNA MATRIZ
·         Int  M[ ] [ ]= new int [ A ][ A ];  // (new)asignación dinámica de memoria.
·         Object  O[ ] [  ]= new Object[ A][ A ]; // matriz de objetos tamaño AxA.
·         Arrays[ ][ ] V2 = new Arrays[5][5];  // método,  importamos la    librería                               import java.util.Vecto; o : import java.util.Arrays;
·         Int M3[  ][  ]; // referencia de una matriz 
2.- INGRESAR DATOS
BUFFER .- Almacenamiento temporal de memoria auxiliar.
              constante
·         M[ 0 ][ 2 ] = 25; //              0      0   25
                                            0      0     0
·         BufferReader Val = (new BufferReader(new Imput SheamReader(System.In)));
//  valores  desde el  teclado.
·         Int num = Integer.ParseIn(Val.readLine() ); // Captura  datos
For( int i = 0; i < n; i ++){
For( int j = 0; j < n; j ++){
      V1[ i ] [ j ] = Integer.ParseIn(Val.readLine());
       }
}
·         Scanner V = new Scanner(System.In); // esta es otra forma.
3.- MOSTRAR DATOS
public static void Mostrar( int V[ ][ ] ){
    for( int i = 0; i < V.length; i ++ ){
        for( int j = 0; j < V.length; j ++ ){
            System.out.print( V[i][j]+"\t");
        }
        System.out.print("\n");
    }
}
// Mostramos en pantalla
public static void main(String[] args) {
            int int M[ ][ ]= new int [ n ][ n ];
            System.out.println(“Mostramos elementos de la matriz: ”);
Mostrar(M);
}
4.-   OTROS ALGORITMOS
                     2   5   5
        A    =       3   2   5
                     8   2   9 
 Uma Matriz M X N   de la misma Dimension.
      Uma Matriz M X N   de la misma Dimension.public class Matriz {
    public static void mostrar(int M[][]){
         int i,j;
             for(i = 0; i < M.length; i ++ ){
                for(j = 0; j <M.length; j ++ ){
                      System.out.print("\t " + M[i][j]);
         }
                System.out.println("\n");
        }
      }
       public static void main(String[] args) {
              int m[][]={{2,5,5},
                         {3,2,5},
                         {8,2,9}};
                     //  Arrays.sort(M);
                       mostrar(m);
    }
}
   Visualización               3 x 3
         2         5         5
         3         2         5
         8         2         9
                ********
 A continuación un programa que almacene la matriz anterior en un arreglo, la eleve al cuadrado e imprima el resultado en la pantalla.
      A continuación un programa que almacene la matriz anterior en un arreglo, la eleve al cuadrado e imprima el resultado en la pantalla.class arreglos
{
  static public void main(String args[])
  {
    double a[][] = {{1,2,3}, {4,5,6}, {7,8,9}};
    double b[][] = new double [3][3];
    int i, j;
    for(i=0; i< 3; i++)
      for(j=0; j<3; j++)
        b[i][j] = a[i][j] * a[i][j];
     for(i=0; i< 3; i++)
    {
      for(j=0; j<3; j++)
        System.out.print(b[i][j] + " ");
      System.out.println("");
    }
  }
}
Visualización en pantalla
4.0 25.0 25.0 
9.0 4.0 25.0 
64.0 4.0 81.0
              *******
 Para hacer uma matriz tamaño m x n que muestre matriz transpuesta y que sume todos los elementos de la matriz
      Para hacer uma matriz tamaño m x n que muestre matriz transpuesta y que sume todos los elementos de la matriz import java.util.Scanner;
import javax.swing.JOptionPane;
class MatrizCencilla{
 public static void main(String[] args){
     Scanner en=new Scanner(System.in);
     int A[][]=new int[100][100];
     int n,m,suma=0;
     int i,j;
  m=Integer.parseInt(JOptionPane.showInputDialog("La cantidad    de la fila  = "));
       n=Integer.parseInt(JOptionPane.showInputDialog("La cantidad de la columna = "));
         System.out.println("FILA =  "+m);
           System.out.println("COLUMNA =  "+n);
        for(i=0;i<m;i++){
         for(j=0;j<n;j++){
             A[i][j]=en.nextInt();
          }   
  }
        System.out.println("     MATRIZ   MXN    \n");
        for(i=0;i<m;i++){
          for(j=0;j<n;j++){
             System.out.print("\t"+A[i][j]);
      }
      System.out.print("\n\n");
    }
         System.out.println("    MATRIZ TRANSPUESTA\n  ");
         for(j=0;j<n;j++){
             for(i=0;i<m;i++){
             System.out.print("\t"+A[i][j]);
       }
      System.out.print("\n\n");
     }
      System.out.println("LA SUMA TOTAL DE LOS ELEMENTOS" + "\n  ");
       for(i=0;i<m;i++){
         for(j=0;j<n;j++){
                 suma  += A[i][j];
         }
     }
        System.out.print("   Total   "+suma);
         System.out.print("\n\n");
  }
}
Visualizamos en pantalla
FILA =  3
COLUMNA =  4
2,4,6,5,4,8,2,6,4,5,2,3// números ingresados desde el teclado  TAM Matriz  3 x 4
     MATRIZ   MXN    
        2        4        6        5
        4        8        2        6
        4        5        2        3
    MATRIZ TRANSPUESTA
        2        4        4
        4        8        5
        6        2        2
        5        6        3
    LA SUMA TOTAL DE LOS ELEMENTOS         
  Suma  Total       51
