need logic for java program


 
Thread Tools Search this Thread
Top Forums Programming need logic for java program
# 1  
Old 10-19-2010
need logic for java program

Hi All,
I need to to wright a java programm for the following query.
Qus: output need to genarate a number+ alphnumric sequence in java and get converted into ASCII code so that i can use mod logic on that. example
Output: like 10 digit number
1AAAAAAAAA
1AAAAAAAAB
1AAAAAAAAC
.
.
1AAAAAAABA
1AAAAAAACA
1AAAAAAADA
.
.
.
1AAAAAABAA
1AAAAAACAA
.
.
..
.
so on
1BAAAAAAAAA
1CAAAAAAAAA
.
.so on
1BAAAAAAAAB
like that

Also i need to convert each number in to ASCII value so that i can use mod logic on each number.
Basically i am genarating referance number which is having 10 digits. also i want to take mod of each number so that i can divide referance number into to instance.
..Anybady can give me logic for that program in java only.
Need to print this pattern just give me solution for few sequence so i can wight next one also it should be very fast in performancewise.

Thanks & Regards,
Ganesh
# 2  
Old 10-19-2010
Well, the digits are a 10 place array of int or char in a CapsAsDigit object, and you increment digits[0] and do the carry to any digit if they get to 26 or are 'Z', and 0-25 + 'A' is A-Z. Just write direct increment logic, not an int decode and encode. Try to avoid divides, like modulus, and multiplies. Pass the array length to the constructor.

UTF-8 or ISO_8859-1 is ACSII up to 127, so do not worry about that so much.

Is the leading 1 just a constant?
# 3  
Old 10-19-2010
Thanks,but need code for it

Hi Thanks for reply,
But could you give me some code regarding that it will be more helpfull for me.
# 4  
Old 10-19-2010
I have not done much with JAVA char[], but check the Character and String API pages. We don't want to be coding if 'A' then 'B'! If you have char[10] and the char[0] == 'Z', incChar( 0 ) would set 'char[0] to 'A' and call incChar( 1 ) for a recursive solution, but you want a iterative solution since push and pop the stack costs.

Character (Java Platform SE 6)

Characters (The Java™ Tutorials > Learning the Java Language > Numbers and Strings)
# 5  
Old 10-20-2010
Quote:
Originally Posted by Ganesh Khandare
Thanks,but need code for it...
... could you give me some code regarding that it will be more helpfull for me.
Why do you "need" code ? Why not put in some effort yourself ? Why do you want us to spoonfeed you complete programs ?

The only way you will learn is by writing Java programs yourself, just like swimming or riding a bike. DGPickett has given you excellent directions, algorithm steps and links to the relevant Java API. That should be enough to get you started.

tyler_durden
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Program java arguments

Hello, The arguments are strings. In my code I need them to be a different type, I do the cast but it is not feasible ... Have you any idea? Thank you (8 Replies)
Discussion started by: chercheur857
8 Replies

2. Programming

Connecting ssh in java program

Hi I have been trying to connect a remote linux server in a java program through ssh. Can anyone tell me the proper library to include? Thanks Ananth (0 Replies)
Discussion started by: Ananthdoss
0 Replies

3. Shell Programming and Scripting

Automating a Java program using KSH

Hi Guys, We have a java program that basically install updates to an existing software. The java program consist of several screens asking user for choices (please see below for a detailed example) *** Screen 1 *** Please choose the operation you want to perform: 1. Install new... (5 Replies)
Discussion started by: maddmaster
5 Replies

4. Shell Programming and Scripting

Executing a Java Program

I am entirely new to shell scripting and would like to create a script to execute a java program called Main. I've already compiled it and placed the .java and .class files at /root/javaTest. Next I made a shell script that simply contained: java /root/javaTest/Main . I made the script... (2 Replies)
Discussion started by: hypnotic_meat
2 Replies

5. Linux

running java program question

hi, i have just written a simple hello world java program in my linux server, installed jdk ... and tried to compile and run it and it gave me some errors. please details below: # cat HelloWorld.java import java.util.*; import java.io.*; public class HelloWorld { public static void... (4 Replies)
Discussion started by: k2k
4 Replies

6. Shell Programming and Scripting

shell program code logic

Hi, I have a file (log data) with the sample code as follows /apps/opt | go_gen.ksh | #START | jan 28 06:15 |/home/dump /apps/opt | go_gen.ksh | #END | jan 28 06:30 |/home/dump /apps/opt | pend_instl.ksh | #START | jan 28 09:50 |/home/dump /apps/opt | pend_instl.ksh | #END | jan... (3 Replies)
Discussion started by: karthikd214
3 Replies

7. Shell Programming and Scripting

How to execute java program from perl

hello all how can i run the java command that can eccept N numbers of args for example : java -cp .;foo.jar myApp 1 "ww" or java -cp .;foo.jar myApp 1 2 3 "ww" or java -cp .;foo.jar myApp "args1" "args2" "args3" Thanks (1 Reply)
Discussion started by: umen
1 Replies

8. Shell Programming and Scripting

how can i run java program from any where

Hello all sorry didnt know where to post it i compiled simple program that using "System.getProperty("user.dir");" now i compiled the program under directory foo and and its running great when i do "java myapp" i included this directory in the $PATH env variable so i could see it fro any where... (1 Reply)
Discussion started by: umen
1 Replies

9. UNIX for Advanced & Expert Users

Invoke java program in different processc d

I have a simple script like this: for file in $dodfiles; do ./rundod $file done $dodfiles is an array of file names selected rundod is a script which invokes a java progrm which process a data file all the processing message logged into a log file in order to extract and analyze the... (1 Reply)
Discussion started by: liux99
1 Replies

10. Programming

Communication between a java and c++ program

Hi, I have the following problem. I have 2 programs, a java program and a c++ program. These 2 programs have to communicate with each other in full duplex mode. I want to use pipes for this communication. So when the c++ program pust something on the stdout the java program must be able to read... (4 Replies)
Discussion started by: lmnt22
4 Replies
Login or Register to Ask a Question