I am new in Java programming language and i want to use a library by importing their packages . Can anyone tell me how can i import packages in Java using text editor? I found this library in github and i wanted to use their packages for my java code i am developing by using import. I tried just to call these packages on my code by using import but in compiler there was an error which states: packages not found.
import com.tiemens.secretshare.main.cli.*;
import com.tiemens.secretshare.main.cli.*;
import java.io.*;
import java.math.BigInteger;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static java.lang.Integer.min;
import static java.util.Arrays.copyOfRange;
public class Shamir {
//The encoding that will be used when splitting and combining files.
static String encoding = "ISO-8859-1";
//The number of bytes per piece (except maybe the last one)!
static int pieceSize = 128;
//Mode 0 for strings, 1 for ints.
public static ArrayList<String> shamirSplit(String inputString, int numPieces, int minPieces, int mode) {
String type = "-sS";
if (mode == 1) {
type = "-sN";
}
ArrayList<String> parts = new ArrayList<>();
String[] splitArgs = {"-n", Integer.toString(numPieces), "-k", Integer.toString(minPieces), type, inputString, "-primeNone"};
MainSplit.SplitInput splitInput = MainSplit.SplitInput.parse(splitArgs);
MainSplit.SplitOutput splitOutput = splitInput.output();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
splitOutput.print(ps);
String content = baos.toString(); // e.g. ISO-8859-1
BufferedReader reader = new BufferedReader(new StringReader(content));
String line;
int i = 0;
try {
while ((line = reader.readLine()) != null && i < numPieces) {
if (line.startsWith("Share (x")) {
i++;
parts.add(line.trim());
}
}
} catch (Exception e)
So my class i want to implement is Shamir class but i need to import com.tiemens.secretshare.main.cli.*;
Can anyone tell me how to make this package work for my Shamir class?