Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8491017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:17:38+00:00 2026-06-10T22:17:38+00:00

For a class project I’m producing a ROT13-like encryption method, the only difference in

  • 0

For a class project I’m producing a ROT13-like encryption method, the only difference in ours is that instead of the 13th character away, it is the 9th. Surprisingly I was able to produce something that works on lowercase letters to see if my method works.

It works, but for some reason, odd characters appear, more commonly question marks and sometimes just extra characters that aren’t in the original character array.

For example: my name results in ljb|nh?. | and ? shouldn’t be there, at least to my knowledge they shouldn’t.

Can anyone tell me why this might be happening by looking at my code?

public class Encrypt {
    public static void main(String[] args) {
        // Lower a-z: 97-122; Higher A-Z: 65-90
        jumble("casey");
    }
    public static void jumble(String input) {
        char[] phraseChar = input.toCharArray();
        // StringBuilder output = new StringBuilder("");

        for (int i = 0; i < phraseChar.length; i++) {
            System.out.print("" + phraseChar[i]);
        }

        System.out.println();

        for (int j = 0; j < phraseChar.length; j++) {
                int i = (int) phraseChar[j];
                if (i >= 'a' && i <= 'z') {
                    i += 9;
                    if (i > 'z') {
                        int newChar = 96 + (i - 'z');
                        System.out.print((char) newChar);
                    }
                    System.out.print((char) i);
            }
        }
    }
}

Anyone who can help me pinpoint this problem is a saint.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T22:17:40+00:00Added an answer on June 10, 2026 at 10:17 pm
    if (i >= 'a' && i <= 'z') { 
       i += 9; 
       if (i > 'z') { 
           int newChar = 96 + (i - 'z'); 
           System.out.print((char) newChar); 
       } 
       System.out.print((char) i);
     }
    

    If i is out of bounds, you are printing both the “corrected” character and the original out-of-bounds one. Put an else

    I am not a saint. Use a debugger for these things. That knowledge will be handy in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model in Django that looks like this: class Project(models.Model): name =
I want to store some data from structures like this: class Project { ChildA
I'm building a class project (seperate dll) that will contain various helper methods and
I had a class project consisting in programming a swype-like. I had to do
I have a Project class like this : class Project { static hasMany =
I use thinking-sphinx like this : class Project < ActiveRecord::Base define_index do indexes title
So I'm working on a class project that uses MFC. I never had to
I have a class like this : public class Project { List<Object> list1; List<Object>
With ASP.net MVC I have a Model like so: public class Project { public
I have a domain like this: class Project { ... Unit ProjectUnit } class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.