I know this may be already answered, but here we go [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 days ago.
Improve this question
I have to make a massage out of a sentence. from this: "Jutri sem sama" to "ur e aaJtismsm" this.
What method should I use?
String sporocilo= JOptionPane.showInputDialog("Vpiši sporocilo");
int kodirano= sporocilo.length();
System.out.println(sporocilo);
System.out.println(kodirano);
for(int i=0; i<kodirano;i++){
if(sporocilo.length()%2!=0)
System.out.print(sporocilo.indexOf(i));
else
System.out.print(sporocilo.indexOf(i));
}
Like I said, I have to make a new massage out of the old one and I have to mix indekses.

Related

How to generate a random mobile number starts with zero and have 10 digits, that starts with zero? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
My Friend ask me this question and i am posting it here, if you have better approach please share
String getRandomMobileNumber() {
double random = Math.random();
Double randomten = random*1000000000.0;
return "0"+Math.round(randomten);
}
You can use this, see javadoc:
String phoneNumber = "0" + ThreadLocalRandom.current().nextInt(10000000, 99999999);

Write a program in Java though array and pop up element after multiplication [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Inputs ={6,7,8,9,10}
Outputs ={42,56,72,90}
Multiplication needs to be done
// arr[ ] = {6*7,7*8,8*9,9*10}
for i--> input.length
Outputs[i] = input[i]*input[i+1]

Character length finding on string [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Can anyone help me to write code that find how many characters string has.
All you need is - int len = yourString.length();
StringUtils should provide you with something that you are looking for:
int count = StringUtils.countMatches("haahaahaa", "a");
System.out.println(count);

Java BigInteger OR function [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am using Java and have some problems.
I made two BigInteger variables, p and q.
In my code, I want to add if function, like if(p=1 \ q=1).
I tried many ways but there was error. Do you know how to solve this?
Your question is not completely clear, but you need to use the BigInteger.equals() method, as in this example:
if (BigInteger.equals(p, BigInteger.ONE) || BigInteger.equals(q, BigInteger.ONE)) {
// do something
}

how i can make my variable equal any element of my Array? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have
String[] country={"USA","ks a","UK","France"};
I have a variable String z.
I want to say
if(z.equals(any element of my array (USA or ks or France)
but randomly:
if(z.equals(country[i]){
Doing action any code
}
Can anybody help me?
you can use
if ( Arrays.asList(country).contains(z)) {
// your code
}

Categories

Resources