Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. public MyVector( int n )
  2. { /* if n<=0 changes n to 1; it initializes the created MyVector object to represent the all-zero vector with n elements */
  3. if (n <= 0)
  4. n = 1;
  5. this.dim = n;
  6.  
  7. //Insert array has all zeros here
  8. }
  9.  
  10. public MyVector( int[] values )
  11. { /* initializes the BVector object to represent the boolean vector data*/
  12. this.dim = values.length;
  13. this.vectorElements = new int[dim];//allocates the array
  14.  
  15. //here copy the elements from array values to array vectorElements
  16. for( int i=0; i<dim; i++ ){
  17. this.vectorElements[i] = values[i];
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement