aspose file tools*
The moose likes Beginning Java and the fly likes Problem faced in execution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem faced in execution " Watch "Problem faced in execution " New topic
Author

Problem faced in execution

jeya prabha
Greenhorn

Joined: Jun 03, 2008
Posts: 23
import java.util.StringTokenizer;
import java.util.ArrayList;

public class Test
{
public static final String COMMA_DELIMITER = ",";

String aLineA = "a= abcd"; // inline:/+c8nARgUo0DJyPkMoBm6hGRMYpCFZUGKYY61+qM";
String vLineA = "a= ijkl"; // inline:llhG/8JE//+o/8I9/+h1//+DOxsneRJpFnNb/41z";

// Initialize Audio and Video Cry Variables for Format "AES_CM_128_HMAC_SHA1_32"

String aLineB = "a= efgh"; // inline:/+c8nARgUo0DJyPkMoBm6hGRMYpCFZUGKYY61+qM";
String vLineB = "a= mnop"; // inline:llhG/8JE//+o/8I9/+h1//+DOxsneRJpFnNb/41z";


int token = 0;
String Life = "24,25,28";


String Length = "4";
StringBuffer aCryA = new StringBuffer();
StringBuffer aCryB = new StringBuffer();
StringBuffer vCryA = new StringBuffer();
StringBuffer vCryB = new StringBuffer();



public Test()
{
printValues();
}

public void printValues()
{

getAudA();
getVidA();

}


public String getAudA()
{
String value = null;
int c = 1, j=1;

aCryA.append(aLineA);
aCryB.append(aLineB);

if ((Life != null) && (Length != null)) {
StringTokenizer stk = new StringTokenizer(Life, ",");
token = stk.countTokens();
while (stk.hasMoreTokens()) {
String s = stk.nextToken();
aCryA.append("inline");
aCryA.append("|");
aCryA.append(s);
aCryA.append("|");
aCryA.append(c++ + ":" + Length);

aCryB.append("inline");
aCryB.append("|");
aCryB.append(s);
aCryB.append("|");
aCryB.append((j + token++) + ":" + Length);

if (c <= token) {
aCryA.append(";");
aCryB.append(";");
}
}
System.out.println(aCryA);
System.out.println(aCryB);

}

return value;
}


public String getVidA()
{
String value = null;
int c = 2, j=2;

vCryA.append(vLineA);
vCryB.append(vLineB);

if((Life != null) && (Length != null)) {
StringTokenizer stk = new StringTokenizer(Life, ",");
token = stk.countTokens();
while (stk.hasMoreTokens()) {
String s = stk.nextToken();
vCryA.append("inline");
vCryA.append("|");
vCryA.append(s);
vCryA.append("|");
vCryA.append((c+2 + token++) + ":" + Length);

vCryB.append("inline");
vCryB.append("|");
vCryB.append(s);
vCryB.append("|");
vCryB.append((j++ + token++) + ":" + Length);
if (c <= token) {
vCryA.append(";");
vCryB.append(";");
}

}

System.out.println(vCryA);
System.out.println(vCryB);
}
return value;
}

public static void main(String[] args)
{
new Test();
}

}

output :

a= abcdinline|24|1:4;inline|25|2:4;inline|28|3:4;
a= efghinline|24|4:4;inline|25|5:4;inline|28|6:4;
a= ijklinline|24|7:4;inline|25|9:4;inline|28|11:4;
a= mnopinline|24|6:4;inline|25|9:4;inline|28|12:4;

i want output sequentially as: (The output depends on "Life" value)

a= abcdinline|24|1:4;inline|25|2:4;inline|28|3:4;
a= efghinline|24|4:4;inline|25|5:4;inline|28|6:4;
a= ijklinline|24|7:4;inline|25|8:4;inline|28|9:4;
a= mnopinline|24|10:4;inline|25|11:4;inline|28|12:4;

(The output depends on "Life" value) for e.g
if you giv Life= "25,26"

then output as
a= abcdinline|24|1:4;inline|25|2:4
a= efghinline|24|3:4;inline|25|4:4
a= ijklinline|24|5:4;inline|25|6:4
a= mnopinline|24|7:4;inline|25|8:4

(Note ";" will not come at the end)

please give me solution ASAP.

Regards
jeya
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19696
    
  20

First, please UseCodeTags. It makes your code more readable.

Second, we are NotACodeMill. We will not provide you with all the answers, you have to do the main work yourself. We will only point you in the right direction.

Third, please EaseUp. There is no need for the "ASAP". We are all volunteers who are not being paid for posting here, so you can't demand that we put everything down to help you.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem faced in execution