1. 

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
* FWP, Angewandte Mathematik, SS11
* Problem: 11962 - DNA II
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9
*
* @author Sebastian Stumpf
* @author Benjamin Vogt
* @version 1.0, 2011-05-30 08:24:54
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.132
*/
public class Main
{
public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int testCases = Integer.valueOf(reader.readLine());
for(int i = 0; i < testCases; ++i)
{
String dna = reader.readLine();
int length = dna.length();
long index = 0;
long power = 1;
// the index is computed by the sequence ..... + X*4^3 + X*4^2 + X*4^2 + X*4^1 + X*4^0,
// X is 0, if the as is A, 1, if C, 2 if G, 3 is T
for(int j = length-1; j >= 0; --j)
{
char as = dna.charAt(j);
switch(as)
{
case 'C':
index += power;
power *= 4;
break;
case 'G':
index += 2 * power;
power *= 4;
break;
case 'T':
index += 3 * power;
power *= 4;
break;
default:
power *= 4;
break;
}
}
System.out.println("Case "+(i+1)+": ("+length+":"+index+")");
}
}
}

2.

/**
* Angewandte Mathematik, SS11
* Problem: 11962 - DNA II
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=229&page=show_problem&problem=3113
*
* @author Unverzart Michael
* @author Wurth Manuel
* @version 1.0, 12/06/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.244
*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class Main {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int n = new Integer(reader.readLine());
for(int i=1;i<=n;i++ ){
char[] input = reader.readLine().toCharArray();
int a = input.length;
BigInteger b = BigInteger.ZERO;
int c = 0;
for(int j=a-1;j>=0;j--){
switch (input[j]) {
case 'C':
b = b.add(BigInteger.valueOf(4).pow(c));
break;
case 'G':
b = b.add(BigInteger.valueOf(4).pow(c).multiply(BigInteger.valueOf(2)));
break;
case 'T':
b = b.add(BigInteger.valueOf(4).pow(c).multiply(BigInteger.valueOf(3)));
break;
default:
break;
}
c++;
}
System.out.println("Case "+i+": ("+a+":"+b+")");
}
}
}