# BigInt Class

Step 1: problem domain

In this section, we want to develop a class that can support big integer numbers and operations among them.

For example we want to calculate 100! and save it in an object of BigInt. After that we want to plus 100! to 2100 and finally show the results.

Step 2: Public Interface

2-1- Constructor Methods

```public BigInt();               // set to 0
public BigInt(String number);
// to support:  BigInt x=new BigInt("233523523503452305235030252");
public BigInt(long number);
public BigInt(BigInt number);```

2-2- Setter Methods

```public void Set(String number);
public void Set(long number);
public void Set(BigInt number);
public void Set(int index, char digit);
public void Set(int index, byte digit);```

2-3- Getter Methods

```public byte[] getArray();
public byte digitAt(int index);
public int getSign();
public int Length();

public long getLastOperationTime();
// by this method, users can get last operation time consuming```

2-4- Functionalities of class (Methods)

```// x.setSum(a,b);  instead of   x=a+b;
public void setSum(BigInt a, BigInt b);

// x.setMinus(a,b);  instead of   x=a-b;
public void setMinus(BigInt a, BigInt b);

// x.setMultiple(a,b);  instead of   x=a*b;
public void setMultiple(BigInt a, BigInt b);

// x.setDiv(a,b);  instead of   x=a/b;
public void setDiv(BigInt a, BigInt b);

// x.setMod(a,b);  instead of   x=a%b;
public void setMod(BigInt a, BigInt b);

// x.setBigFact(100);  instead of   x=100!;
public void setBigFact(int a);

// x.setBigPow(2,100);  instead of   x=2^100;
public void setBigPow(int a,int b);

// cast to BigDouble
public BigDouble toBigDouble();```

2-5- Standard Library Methods overloading (such as toString, equals,…)

```public String toString();
public int compareTo(BigInt a);
public boolean equals(Object anObject);
public int hashCode();
public BigInt clone();```

Step 3: private variables

Private variables of this class may be implemented two ways:

1- just use a String S.

2- use an array of byte and length of it.

in each method we need a variable to keep the latest operation time.

Step 4: implementing main classes

Students work !

Step 5: useful application

BigInt CALC projects are applications of this class.