Radix64 - import java.io.*; i import java.util.*; p public...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.*; import java.util.*; i public class Radix64 { p // Pre-condition: c is a valid Radix-64 character. // Post-condition: c's integer code (in between 0 and 63, inclusive), will be returned. public static int convertChar(char c) { p return (int)(c - 'A'); return (int)(c - 'a' + 26); return (int)(c - '0' + 52); else if (c == '+') return 62; return 63; } public static char convertInt(int value) { if (value < 26) return (char)('A' + value); else if (value < 52) return (char)('a' + value - 26); else if (value < 62) return (char)('0' + value - 52); else if (value == 62) return '+'; return '/'; } // Pre-condition: radix64 is a 10 character block in radix64 characters only. // Post-condition: A 64 bit equivalent binary string will be returned, solely // consisting of the characters '0' and '1'. Since the 10 // characters only convert to 60 bits, the last four bits of the // returned string are guaranteed to be '0'. public static String convertBlock(String radix64) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/13/2011 for the course CIS 3362 taught by Professor Staff during the Fall '08 term at University of Central Florida.

Page1 / 3

Radix64 - import java.io.*; i import java.util.*; p public...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online