Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Problems faced in execution

This is a discussion on Problems faced in execution within the Java forums, part of the Software Development category; 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"; // ...

Go Back   Geeks Talk > Software Development > Java
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

Java Java related Issues and Problems

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-09-2008
Junior Member
 
Join Date: Jun 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
jeyaprabha is on a distinguished road
Problems faced in execution

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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-20-2008
Junior Member
 
Join Date: Jan 2008
Location: India
Posts: 19
Thanks: 0
Thanked 3 Times in 1 Post
kumarprabu is on a distinguished road
Re: Problems faced in execution

i solved this. if any problem reply

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 = "b= 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 = "c= efgh"; // inline:/+c8nARgUo0DJyPkMoBm6hGRMYpCFZUGKYY61+qM";
String vLineB = "d= 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();
int tst = 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);
tst--;
if (c <= token) {
if(tst > 0 ){
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();
int tst = 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);
tst--;
if (c <= token) {
if(tst>0){
vCryA.append(";");
vCryB.append(";");
}
}
}

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

public static void main(String[] args)
{
new test();
}
}
Reply With Quote
Reply

  Geeks Talk > Software Development > Java

« eclipse | question »
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Detecting Object Problems Lokesh M AJAX & XML 0 03-10-2008 06:15 AM
problems for ora9i administrator anythinga Oracle 0 01-23-2008 11:01 AM
Has anyone faced this Situation christia Companies 3 05-09-2007 08:42 AM
Microsoft CRM 3.0 problems F2F Geek Get Together 0 01-30-2007 11:05 AM
weighting problems... psuresh1982 Brainteasers 4 01-02-2007 06:06 AM


All times are GMT -4. The time now is 12:53 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved