|
am bit confused to get the logic for the programm
|
|
|
|
|
How would you find the first occurence of a character?
By comparing each character starting at the begin of the string until found or reaching the end of the string.
For the last occurence do it similar but start at the end of the string.
|
|
|
|
|
Take a sheet of paper and write a sentence.
How do you find the first space ?
How do you find the last space ?
What is the algorithm difference ?
you program should do the same.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
public static int lastOccunrance(String s ,char c)
{
int index=1;
int foundAtindex=-1;
for(char t:s.toCharArray())
{
if(t==c)
foundAtindex=index;
index++;
}
return foundAtindex;
}
// If not found then return -1
|
|
|
|
|
I am a Consumer of a SOAP Webservice. where we have one element named "Arrival" in stub given below. This got generated from providers WSDL.
@XmlElement(name = "Arrival", namespace = "https://www.xxxxxxxx.com/xxxxxx/", required = true)
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar arrival;
** As of now we are sending Full Datetime in this element but now they are expecting only "Year" value but when i tried doing it i am getting:-
javax.xml.ws.soap.SOAPFaultException: Error in deserializing body of request message for operation xxxxxx.
|
|
|
|
|
Where are you getting this exception? What data is contained in the response?
|
|
|
|
|
Anyone Help me to explain how does this code works
DataInputStream in= new DataInputStream(new FileInputStream(steg.getFile()));
in.read(byteArray, 0, fileSize);
in.close();
Cipher cipher= Cipher.getInstance("DES");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(password.substring(0, 8).getBytes(), "DES"));
byteArray= cipher.doFinal(byteArray);
|
|
|
|
|
It reads encrypted information from a file and decrypts it.
|
|
|
|
|
Can u please explain how that code works.
|
|
|
|
|
Sorry but this forum is for programming questions. If you want to learn a language or some of its features then you should consult the documentation.
|
|
|
|
|
Yes, so only i am asking to explain the code.
|
|
|
|
|
I have explained the code. If you want the full details of each line then you need to read the documentation for each library function.
|
|
|
|
|
u explain and provide those documentation..
|
|
|
|
|
Sorry we are not here to teach you programming. And Google will find you the documentation.
|
|
|
|
|
then what kind of stuff u provide here.
|
|
|
|
|
|
it's a forum another person had answered for this question. so if u know programming u can explain ,,,, how does this code process... it's Audio steganography using LSB technique by this u wouls have answered.
|
|
|
|
|
nice project lot of work is involved in audio steganography.
|
|
|
|
|
/forums/help-with-project-t586857.html
(Link removed.)
|
|
|
|
|
|
Yes sir, need help in Audio Steganography in java
|
|
|
|
|
HI im tryin to implement dijkstra's algorithm in java but my output is not correct. The output should be [0,492,665,114,452,999] but i keep getting a different range.Can anybody help please as i need this for my assignment. Thnks
public ArrayList <Integer> dijkstra (int start, int end)
{
int N = adj.length;
HashMap <Integer,Double> Q = new HashMap <Integer,Double>();
ArrayList <Integer> [] paths = new ArrayList [N];
for (int i=0;i<N;i++)
{
Q.put(i,Double.POSITIVE_INFINITY);
paths[i]=new ArrayList <Integer>();
paths[i] = new ArrayList<Integer>(start);
}
HashSet <Integer> S= new HashSet();
S.add(start);
Q.put(start,Q.get(start));
while (!Q.isEmpty())
{
int v = findSmallest(Q);
if (v==end && Q.get(v)!= Double.POSITIVE_INFINITY)
return paths[end];
double w = Q.get(v);
S.add(v);
for(int u: neighbours(v))
if (!S.contains(u))
{
double w1= adj[u][v] + w;
if (w1 < Q.get(u))
{
Q.put(u,w1);
paths[u]= addToEnd(v,paths[u]);
}
}
Q.remove(v);
}
return new ArrayList <Integer> ();
}
|
|
|
|
|
Quote: The output should be [0,492,665,114,452,999]
You prevent yourself from getting help because we don't have the input data and we don't have actual result.
When you don't understand what your code is doing or why it does what it does, the answer is debugger.
Use the debugger to see what your code is doing. Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute, it is an incredible learning tool.
Debugger - Wikipedia, the free encyclopedia[^]
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html[^]
https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html[^]
The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't find bugs, it just help you to. When the code don't do what is expected, you are close to a bug.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
hello ...i want to give separate hyperlink to resultset data, how can i do that?
|
|
|
|
|
This didn't make any sense when you posted it in QA:
Hello ...i want to give different hyperlink for result-set data, please help me[^]
What makes you think that reposting exactly the same question in the Java forum is going to end any differently?
Go to your QA question, click the green "Improve question" link, and add some proper detail to your question.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|