Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Base64{
- public static int getBase64ByteSize(String str){
- String[] specialSigns = new String[] {"\u00C4","\u00E4","\u00D6"};
- int amountspecialSigns = countSpecialSigns(str, specialSigns);
- int n = str.length();
- int z = 4 * (int) Math.ceil( (double) n/3);
- return z;
- }
- public static int countSpecialSigns(String str, String[] specialSigns){
- int count = 0;
- for (int i=0; i < str.length(); i++){
- for (int l=0; l< specialSigns.length; l++){
- if (str.charAt(i).toString() == specialSigns[l]){
- count++;
- }
- }
- }
- return count;
- }
- public static void main(String[] args){
- System.out.println(getBase64ByteSize("Hällo"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement