You could do something like:

String one= "ROLEAWARDS ROLEMOVIES ROLENOMINATIONS"; 
String two = "ROLENOMINATIONS ROLEAWARDS ROLEMOVIES";
String oneArray[] = one.split("\\s+");
String twoArray[] = one.split("\\s+");
Arrays.sort(oneArray);
Arrays.sort(twoArray);
if(Arrays.equals(oneArray, twoArray))
{
    System.out.println("Contains");
}
else
    System.out.println("Doesn't Contain");
}
Answer from SMA on Stack Overflow
🌐
W3Schools
w3schools.com › java › ref_string_contains.asp
Java String contains() Method
The contains() method checks whether a string contains a sequence of characters. Returns true if the characters exist and false if not. ... The CharSequence interface is a readable sequence of char values, found in the java.lang package.
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › String.html
String (Java Platform SE 8 )
July 21, 2026 - Allocates a new String that contains characters from a subarray of the Unicode code point array argument. The offset argument is the index of the first code point of the subarray and the count argument specifies the length of the subarray.
🌐
Baeldung
baeldung.com › home › java › java string › java string.contains()
Java String.contains() | Baeldung
April 11, 2025 - A quick example and explanation of the contains API of the standard String class in Java.
🌐
BeginnersBook
beginnersbook.com › 2017 › 10 › java-string-contains-method
Java String contains() method
June 10, 2024 - Java String contains() method checks whether a particular sequence of characters is part of a given string or not.
🌐
TechVidvan
techvidvan.com › tutorials › java-string-contains-method
Java String contains() Method - TechVidvan
March 4, 2024 - The contain() method checks to see if a character sequence is present in the string. If the characters exist and if they don’t, returns true. Syntax: public boolean contains(CharSequence chars) In Java’s string data type, a variety of methods are available to manage and manipulate the text ...
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-string-contains-method-example
Java String contains() Method with Example - GeeksforGeeks
July 11, 2025 - In this example, we check if a specific substring is present in the given string. ... // Java Program to demonstrate working contains() method class Gfg { public static void main(String args[]) { String s = "My name is GFG"; System.out.println(s.contains("GFG")); System.out.println(s.contains("geeks")); } }
🌐
CodeGym
codegym.cc › java blog › strings in java › java string contains() method
Java String contains() Method
January 8, 2025 - java.lang.String provides a boolean method contains() that returns ‘true’ if a sequence of characters is found within the given string and ‘false’ otherwise
🌐
Tutorialspoint
tutorialspoint.com › java › lang › string_contains.htm
Java - String contains() Method
The Java String contains() method is used to check whether the current string contains the specified sequence. It returns the Boolean value, which is true if and only if the string contains the sequence of char values; false otherwise.
Find elsewhere
🌐
DEV Community
dev.to › tpointtechblog › java-string-contains-vs-other-string-methods-what-you-should-know-1hag
Java String contains() vs Other String Methods: What You Should Know - DEV Community
August 31, 2025 - Whether you’re building applications, ... these methods, the java string contains() method is often used to check if a particular sequence of characters exists within a string....
🌐
Medium
medium.com › @AlexanderObregon › checking-if-a-string-contains-a-word-or-phrase-in-java-08ef51495d87
Checking if a String Contains a Word or Phrase in Java
June 16, 2025 - String checks in Java come down to comparing one set of characters to another. That can be as basic as looking for a single word inside a sentence, or something a bit more structured like checking for a specific pattern in user input. Java gives you three commonly used tools for this: contains, indexOf, and matches.
🌐
Guru99
guru99.com › home › java tutorials › java string contains(): check if string contains substring
Java String contains(): Check if String contains Substring
June 30, 2026 - The Java String contains() method is used to check whether the specific set of characters are part of the given string or not. It returns a boolean value true if the specified characters are substring of a given string and returns false otherwise.
🌐
Programiz
programiz.com › java-programming › library › string › contains
Java String contains()
The contains() method checks whether the specified string (sequence of characters) is present in the string or not. class Main { public static void main(String[] args) { String str1 = "Java String contains()"; // check if str1 contains "Java"
🌐
Vultr Docs
docs.vultr.com › java › standard-library › java › lang › String › contains
Java String contains() - Check If Contains Substring | Vultr Docs
November 19, 2024 - The contains() method in Java is a crucial function for string manipulation, used extensively to determine whether a particular substring exists within another string.
🌐
Career Karma
careerkarma.com › blog › java › java string contains: a step-by-step guide
Java String Contains: A Step-By-Step Guide | Career Karma
December 1, 2023 - The Java string data type offers a number of methods that can be used to process and manipulate the contents of a string. One of these methods is called contains(), which can be used to find out if a string contains a sequence of characters.
🌐
Net Informations
net-informations.com › java › string › contains.htm
Java String contains()
The Java String contains() method allows you to determine whether a specific character sequence is present within a given string.
🌐
Scaler
scaler.com › home › topics › contains() in java
contains() in Java | contains() Function in Java - Scaler Topics
May 5, 2024 - The contains() method is a feature of Java's String class. It's designed to seek out a specific sequence or set of characters within a given string. Notably, it's unable to be used to search for a single character, though we can delve into that further later on.
🌐
iO Flood
ioflood.com › blog › java-string-contains
Java String Contains(): A Detailed Usage Guide
February 26, 2024 - Think of the ‘contains’ method as a detective – it helps you find the clues (sequence of characters) within the mystery (the string). It’s a powerful tool that can make your coding tasks a lot easier. In this guide, we’ll walk you through the process of using the ‘contains’ method in Java String class, from the basics to more advanced techniques.
🌐
Java Code Geeks
examples.javacodegeeks.com › home › java development › core java
Java String contains() with Example - Examples Java Code Geeks - 2026
June 9, 2020 - The java.lang.String class represents character strings. It has provided a contains method since version 5 to return true if and only if this string contains the specified sequence of char values.
🌐
Codekru
codekru.com › home › java string contains() method
Java String contains() method - Codekru
June 12, 2022 - contains() method is a String class method that will check whether the string contains the specified sequence of char values.