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