Kindly answer this urgently.
You can access the question via the link below. Thanks and plz answer.
https://drive.google.com/file/d/1mfyGOKUB_vdWvXTg6R9tHKYe0du0Rnqi/view?usp=sharing
package longword;
import java.io.*;
import java.util.BitSet;
import java.util.Vector;
public class LongWord {
private BitSet b;
LongWord(){
b=new BitSet(32);
for(int i=0; i<32; i++){
b.set(1010);
}
}
public String toString(){
long [] longs = b.toLongArray();
String s = b.toString();
return s;
}
boolean getBit(int i){
return b.get(i);
}
void setBit(int i){
b.set(i);
}
void toggleBit(int i){
b.flip(i);
}
int getSigned(){
long [] longs = b.toLongArray();
String s = longs.toString();
int sign = Integer.parseInt(s);
return sign;
}
long getUnsigned(){
long [] longs = b.toLongArray();
String s = longs.toString();
long sign = Long.parseLong(s);
return sign;
}
void copy(LongWord other){
this.b = other.b;
}
LongWord shiftLeftLogical(int amount){
LongWord other = new LongWord();
other.b = this.b;
long name = getUnsigned()<<amount;
return other;
}
public static void main(String[] args) {
LongWord l = new LongWord();
}
}
Comments
Leave a comment