Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public IntegerStore2D(int [] a, int k){
- int numerot = 0;
- for(int rivi=0; rivi<=k; rivi++){
- numerot = numerot+rivi;
- }
- if(a.length==numerot){
- this.myArray = new int[k][k];
- int apu = 0;
- for(int i=0; i<k; i++){
- for(int j=0; j<k; j++){
- if (i<j){
- myArray[i][j] = 0;
- }
- else{
- myArray[i][j] = a[apu];
- apu++;
- }
- }
- }
- }
- else{
- System.out.println("Tyhmä määrä lukuja!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement