base64 in java
String originalInput = "test input";
String encodedString = Base64.getEncoder().encodeToString(originalInput.getBytes());
base64 in java
String originalInput = "test input";
String encodedString = Base64.getEncoder().encodeToString(originalInput.getBytes());
convert any base to base 10 java
String input="54C";
int inputBase=16;
int output= Integer.parseInt(input, inputBase);//output= base 10 of 54C = 1356
//or more specific way to show off
static int convertToDec(int inputBase, String input){
int output = 0, index = 0;
int value = 0;
input = input.toUpperCase();
for (int i = input.length() - 1; i >= 0; i--) {
char c = input.charAt(i);
if (c >= '0' && c <= '9')
value = c-48;//in ASCII char '0' is at index 48 so -48 give actual int value
else if (c >= 'A' && c <= 'F')
value = Integer.parseInt(String.valueOf(c)); //or just use String.valueOf(char) instead of -index(ASCII)
output += value * Math.pow(inputBase, index);
index++;
}
return output;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us