Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public MyVector( int n )
- { /* if n<=0 changes n to 1; it initializes the created MyVector object to represent the all-zero vector with n elements */
- if (n <= 0)
- n = 1;
- this.dim = n;
- //Insert array has all zeros here
- }
- public MyVector( int[] values )
- { /* initializes the BVector object to represent the boolean vector data*/
- this.dim = values.length;
- this.vectorElements = new int[dim];//allocates the array
- //here copy the elements from array values to array vectorElements
- for( int i=0; i<dim; i++ ){
- this.vectorElements[i] = values[i];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement