FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-algorithims/CheckRotation.java at main · faraimtb/java-algorithims · GitHub
This repository was archived by the owner on Dec 7, 2024. It is now read-only.
faraimtb
/
java-algorithims
Public archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-algorithims
/
CheckRotation.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (18 loc) · 678 Bytes
Breadcrumbs
java-algorithims
/
CheckRotation.java
Copy path
File metadata and controls
23 lines (18 loc) · 678 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package
com
.
ematrix
;
import
java
.
util
.
Locale
;
public
class
CheckRotation
{
public
boolean
isRotation
(
String
s1
,
String
s2
){
StringBuilder
s3
=
new
StringBuilder
();
if
(
s1
.
length
()!=
s2
.
length
()){
return
false
;}
s3
.
append
(
s1
).
append
(
s1
);
return
s3
.
toString
().
toLowerCase
().
contains
(
s2
.
toLowerCase
(
Locale
.
ROOT
));
}
public
static
void
main
(
String
[]
args
){
String
sOne
=
"Waterbottle"
;
String
sTwo
=
"erbottlewat"
;
CheckRotation
checkRotation
=
new
CheckRotation
();
boolean
result
=
checkRotation
.
isRotation
(
sOne
,
sTwo
);
System
.
out
.
println
(
sTwo
+
" is substring of "
+
sOne
+
" "
+
result
);
}
}
Back
|
FazBrowse Home
|
New Git URL