I was asked to implement an ADT that will replicate some of the capabilities of Java’s BigInteger class. Belove is what I achieved so far, and i have no idea have to write the add() method, as well as the rest.

import java.math.BigInteger;

import java.util.ArrayList;

// Your class should behave as Java’s BigInteger class does. The majority of

// the methods can be studied using Java’s documentation.

public class MyBigInt {

private int bigInt;

long value;

String str;

public MyBigInt (){


public MyBigInt(long value){

this.value = value;


public MyBigInt(String str){

bigInt = Integer.parseInt(str);


public String toString() {

return String.format(“%s;%s”, value, str);


public MyBigInt add(MyBigInt other){


public MyBigInt subtract(MyBigInt other){


public MyBigInt negate(){


public int compareTo(MyBigInt other)

public MyBigInt max(MyBigInt other)

public MyBigInt min(MyBigInt other)

public int signum(){


public static MyBigInt valueOf(long value){

return new MyBigInt(value);



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *