Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package learningjava;
- public class SMatrix {
- private int order;
- private double[][] values = new double[order][order];
- // private static double[] column;
- public SMatrix(int order, double[][] values) {
- this.order = order;
- this.values = values;
- }
- public SMatrix(SMatrix m) {
- this(m.order, m.values);
- }
- public String toString() {
- String s = "";
- for (int i = 0; i < order; i++) {
- for (int j = 0; j < order; j++) {
- s += values[i][j] + "\t";
- if (j == order - 1)
- s += "\n\n";
- }
- }
- return s;
- }
- public static void main(String[] args) {
- double[][] test = { { 1, 2 ,3 }, { 3, 4, 5 } , {5,6,7}};
- SMatrix m = new SMatrix(3, test);
- System.out.println(m.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment