In my android studio project want to use existing java project code
I tried this way:
Click File > New Module. Select Java Library and click Next.>
The following link can be referred to:
https://developer.android.com/studio/intro/migrate.html
Import Eclipse Projects to Android Studio
Import as a Project:
Start Android Studio and close any open Android Studio projects.
From the Android Studio menu click File > New > Import Project. Alternatively, from the Welcome screen, click Import project (Eclipse ADT, Gradle, etc) Select the Eclipse ADT project folder with the AndroidManifest.xml file and click Ok. Select the destination folder and click Next Select the import options and click Finish.
Importing a Gradle-based IntelliJ project
If you are already using Gradle with your IntelliJ project, you can open it in Android Studio using the following steps:
Click File > New > Import Project. Select your IntelliJ project directory, and click OK. Your project will open in Android Studio.