Count palindrome substrings
Shouldn't the count method be called isPalindrome?
count/isPalindrome only needs to iterate over half the string: i&lt;a.length()/2. (Make sure to test it, it might be &lt;=)
You should use boolean instead of int for isPalindrome.
There's no need to create a temporary a variable in countPalindromeSubstrings.
count would probably make more sense than countSubs.
The whitespace seems off.
Keep your indentation consistent (I'm using 4 spaces since that's what I prefer and it's hard to tell what you prefer [I actually prefer tabs, but spaces are strongly recommended on this site]).
Stay consistent with your brace style. I personally prefer K&amp;R/Egyptian/whatever braces (the style you use around the class), but it seems you prefer ANSI/Allman/whatever braces (the style you use everywhere else in this code), so I'll use that.


Point 2 should provide about double the speed; the others probably won't change the speed much, put should still probably be made.

Result:

public class PalindromeSubstrings
{

    public static int countPalindromeSubstrings(String s)
    {
        int count = s.length();
        for(int i = 0; i &lt; s.length(); i++)
        {
            for(int j = i+2; j &lt;= s.length(); j++)
            {
                countSubs += isPalindrome(s.substring(i, j));
            }
        }
        return countSubs;
    }
    public static int isPalindrome(String a)
    {
        for(int i = 0; i &lt; a.length() / 2; i++)
        {
            if(a.charAt(i) != a.charAt(a.length() - 1 - i))
                return 0;
        }
        return 1;
    }
}